@@ -123,40 +123,6 @@ def test_constrained_layout6():
123
123
ticks = ticker .MaxNLocator (nbins = 5 ))
124
124
125
125
126
- @image_comparison (baseline_images = ['constrained_layout8' ],
127
- extensions = ['png' ])
128
- def test_constrained_layout8 ():
129
- 'Test for gridspecs that are not completely full'
130
- fig = plt .figure (figsize = (7 , 4 ), constrained_layout = True )
131
- gs = gridspec .GridSpec (3 , 5 , figure = fig )
132
- axs = []
133
- j = 1
134
- for i in [0 , 1 ]:
135
- ax = fig .add_subplot (gs [j , i ])
136
- axs += [ax ]
137
- pcm = example_pcolor (ax , fontsize = 10 )
138
- if i > 0 :
139
- ax .set_ylabel ('' )
140
- if j < 1 :
141
- ax .set_xlabel ('' )
142
- ax .set_title ('' )
143
- j = 0
144
- for i in [2 , 4 ]:
145
- ax = fig .add_subplot (gs [j , i ])
146
- axs += [ax ]
147
- pcm = example_pcolor (ax , fontsize = 10 )
148
- if i > 0 :
149
- ax .set_ylabel ('' )
150
- if j < 1 :
151
- ax .set_xlabel ('' )
152
- ax .set_title ('' )
153
- ax = fig .add_subplot (gs [2 , :])
154
- axs += [ax ]
155
- pcm = example_pcolor (ax , fontsize = 10 )
156
-
157
- fig .colorbar (pcm , ax = axs , pad = 0.01 , shrink = 0.6 )
158
-
159
-
160
126
def test_constrained_layout7 ():
161
127
'Test for proper warning if fig not set in GridSpec'
162
128
with pytest .warns (UserWarning , match = 'Calling figure.constrained_layout, '
@@ -179,26 +145,20 @@ def test_constrained_layout8():
179
145
fig = plt .figure (figsize = (10 , 5 ), constrained_layout = True )
180
146
gs = gridspec .GridSpec (3 , 5 , figure = fig )
181
147
axs = []
182
- j = 1
183
- for i in [0 , 4 ]:
184
- ax = fig .add_subplot (gs [j , i ])
185
- axs += [ax ]
186
- pcm = example_pcolor (ax , fontsize = 9 )
187
- if i > 0 :
188
- ax .set_ylabel ('' )
189
- if j < 1 :
190
- ax .set_xlabel ('' )
191
- ax .set_title ('' )
192
- j = 0
193
- for i in [1 ]:
194
- ax = fig .add_subplot (gs [j , i ])
195
- axs += [ax ]
196
- pcm = example_pcolor (ax , fontsize = 9 )
197
- if i > 0 :
198
- ax .set_ylabel ('' )
199
- if j < 1 :
200
- ax .set_xlabel ('' )
201
- ax .set_title ('' )
148
+ for j in [0 , 1 ]:
149
+ if j == 0 :
150
+ ilist = [1 ]
151
+ else :
152
+ ilist = [0 , 4 ]
153
+ for i in ilist :
154
+ ax = fig .add_subplot (gs [j , i ])
155
+ axs += [ax ]
156
+ pcm = example_pcolor (ax , fontsize = 9 )
157
+ if i > 0 :
158
+ ax .set_ylabel ('' )
159
+ if j < 1 :
160
+ ax .set_xlabel ('' )
161
+ ax .set_title ('' )
202
162
ax = fig .add_subplot (gs [2 , :])
203
163
axs += [ax ]
204
164
pcm = example_pcolor (ax , fontsize = 9 )
0 commit comments