Skip to content

Commit 3d9fbcc

Browse files
committed
TST: add a test
1 parent 602dfbe commit 3d9fbcc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/tests/test_figure.py

+16
Original file line numberDiff line numberDiff line change
@@ -546,3 +546,19 @@ def test_add_subplot_twotuple():
546546
ax4 = fig.add_subplot(3, 2, (3, 6))
547547
assert ax4.get_subplotspec().rowspan == range(1, 3)
548548
assert ax4.get_subplotspec().colspan == range(0, 2)
549+
550+
551+
def test_reuse_gridspec():
552+
fig = plt.figure()
553+
ax = [None] * 9
554+
for i in range(9):
555+
ax[i] = fig.add_subplot(3, 3, i + 1)
556+
for i in range(1, 9):
557+
assert (ax[i].get_subplotspec().get_gridspec() ==
558+
ax[0].get_subplotspec().get_gridspec())
559+
560+
fig = plt.figure()
561+
ax1 = fig.add_subplot(3, 3, (1, 7))
562+
ax2 = fig.add_subplot(3, 3, (6, 9))
563+
assert (ax1.get_subplotspec().get_gridspec() ==
564+
ax2.get_subplotspec().get_gridspec())

0 commit comments

Comments
 (0)