Skip to content

Commit 2df24aa

Browse files
committed
TST: add a test
1 parent eeaf3e2 commit 2df24aa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_figure.py

+15
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,18 @@ def test_add_subplot_twotuple():
566566
assert ax4.get_subplotspec().colspan == range(0, 2)
567567
with pytest.raises(IndexError):
568568
fig.add_subplot(3, 2, (6, 3))
569+
570+
571+
def test_reused_gridspec():
572+
"""Test that these all use the same gridspec"""
573+
fig = plt.figure()
574+
ax1 = fig.add_subplot(3, 2, (3, 5))
575+
ax2 = fig.add_subplot(3, 2, 4)
576+
ax3 = plt.subplot2grid((3, 2), (2, 1), colspan=2, fig=fig)
577+
578+
gs1 = ax1.get_subplotspec().get_gridspec()
579+
gs2 = ax2.get_subplotspec().get_gridspec()
580+
gs3 = ax3.get_subplotspec().get_gridspec()
581+
582+
assert gs1 == gs2
583+
assert gs1 == gs3

0 commit comments

Comments
 (0)