Skip to content

Commit cc034ad

Browse files
committed
FIX: add test for identical subgridspec
1 parent c682ca4 commit cc034ad

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,26 @@ def test_constrained_layout6():
115115
ticks=ticker.MaxNLocator(nbins=5))
116116

117117

118+
def test_identical_subgridspec():
119+
120+
fig = plt.figure(constrained_layout=True)
121+
122+
GS = fig.add_gridspec(2, 1)
123+
124+
GSA = GS[0].subgridspec(1, 3)
125+
GSB = GS[1].subgridspec(1, 3)
126+
127+
axa = []
128+
axb = []
129+
for i in range(3):
130+
axa += [fig.add_subplot(GSA[i])]
131+
axb += [fig.add_subplot(GSB[i])]
132+
133+
fig.draw_without_rendering()
134+
# chech first row above second
135+
assert axa[0].get_position().y0 > axb[0].get_position().y1
136+
137+
118138
def test_constrained_layout7():
119139
"""Test for proper warning if fig not set in GridSpec"""
120140
with pytest.warns(

0 commit comments

Comments
 (0)