@@ -90,15 +90,15 @@ def example_plot(ax, fontsize=12, nodec=False):
9090# axes overlapping each other.
9191
9292fig , axs = plt .subplots (2 , 2 , constrained_layout = False )
93- for ax in axs .flatten () :
93+ for ax in axs .flat :
9494 example_plot (ax )
9595
9696###############################################################################
9797# Specifying ``constrained_layout=True`` in the call to ``plt.subplots``
9898# causes the layout to be properly constrained.
9999
100100fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
101- for ax in axs .flatten () :
101+ for ax in axs .flat :
102102 example_plot (ax )
103103
104104###############################################################################
@@ -132,7 +132,7 @@ def example_plot(ax, fontsize=12, nodec=False):
132132# the specified axes.
133133
134134fig , axs = plt .subplots (2 , 2 , figsize = (4 , 4 ), constrained_layout = True )
135- for ax in axs .flatten () :
135+ for ax in axs .flat :
136136 im = ax .pcolormesh (arr , ** pc_kwargs )
137137fig .colorbar (im , ax = axs , shrink = 0.6 )
138138
@@ -142,7 +142,7 @@ def example_plot(ax, fontsize=12, nodec=False):
142142# still be the same size.
143143
144144fig , axs = plt .subplots (3 , 3 , figsize = (4 , 4 ), constrained_layout = True )
145- for ax in axs .flatten () :
145+ for ax in axs .flat :
146146 im = ax .pcolormesh (arr , ** pc_kwargs )
147147fig .colorbar (im , ax = axs [1 :, ][:, 1 ], shrink = 0.8 )
148148fig .colorbar (im , ax = axs [:, - 1 ], shrink = 0.6 )
@@ -179,7 +179,7 @@ def example_plot(ax, fontsize=12, nodec=False):
179179# ``constrained_layout`` can also make room for `~.figure.Figure.suptitle`.
180180
181181fig , axs = plt .subplots (2 , 2 , figsize = (4 , 4 ), constrained_layout = True )
182- for ax in axs .flatten () :
182+ for ax in axs .flat :
183183 im = ax .pcolormesh (arr , ** pc_kwargs )
184184fig .colorbar (im , ax = axs , shrink = 0.6 )
185185fig .suptitle ('Big Suptitle' )
@@ -265,15 +265,15 @@ def example_plot(ax, fontsize=12, nodec=False):
265265# `~.figure.Figure.set_constrained_layout_pads`:
266266
267267fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
268- for ax in axs .flatten () :
268+ for ax in axs .flat :
269269 example_plot (ax , nodec = True )
270270 ax .set_xticklabels ('' )
271271 ax .set_yticklabels ('' )
272272fig .set_constrained_layout_pads (w_pad = 4. / 72. , h_pad = 4. / 72. ,
273273 hspace = 0. , wspace = 0. )
274274
275275fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
276- for ax in axs .flatten () :
276+ for ax in axs .flat :
277277 example_plot (ax , nodec = True )
278278 ax .set_xticklabels ('' )
279279 ax .set_yticklabels ('' )
@@ -288,7 +288,7 @@ def example_plot(ax, fontsize=12, nodec=False):
288288# the above, but the space between subplots does.
289289
290290fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
291- for ax in axs .flatten () :
291+ for ax in axs .flat :
292292 example_plot (ax , nodec = True )
293293 ax .set_xticklabels ('' )
294294 ax .set_yticklabels ('' )
@@ -308,7 +308,7 @@ def example_plot(ax, fontsize=12, nodec=False):
308308# of the axis it is attached to.
309309
310310fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
311- for ax in axs .flatten () :
311+ for ax in axs .flat :
312312 pc = ax .pcolormesh (arr , ** pc_kwargs )
313313 fig .colorbar (pc , ax = ax , shrink = 0.6 , pad = 0 )
314314 ax .set_xticklabels ('' )
@@ -322,7 +322,7 @@ def example_plot(ax, fontsize=12, nodec=False):
322322# for ``pad`` to be non-zero.
323323
324324fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
325- for ax in axs .flatten () :
325+ for ax in axs .flat :
326326 pc = ax .pcolormesh (arr , ** pc_kwargs )
327327 fig .colorbar (im , ax = ax , shrink = 0.6 , pad = 0.05 )
328328 ax .set_xticklabels ('' )
@@ -347,7 +347,7 @@ def example_plot(ax, fontsize=12, nodec=False):
347347
348348plt .rcParams ['figure.constrained_layout.use' ] = True
349349fig , axs = plt .subplots (2 , 2 , figsize = (3 , 3 ))
350- for ax in axs .flatten () :
350+ for ax in axs .flat :
351351 example_plot (ax )
352352
353353#############################
@@ -739,10 +739,10 @@ def docomplicated(suptitle=None):
739739# layoutboxes in the gridspec, and it is made to be centered between
740740# those two points.
741741
742- fig , ax = plt .subplots (2 , 2 , constrained_layout = True )
743- for a in ax . flatten () :
744- im = a .pcolormesh (arr , ** pc_kwargs )
745- fig .colorbar (im , ax = ax , shrink = 0.6 )
742+ fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
743+ for ax in axs . flat :
744+ im = ax .pcolormesh (arr , ** pc_kwargs )
745+ fig .colorbar (im , ax = axs , shrink = 0.6 )
746746plot_children (fig , fig ._layoutbox , printit = False )
747747
748748#######################################################################
0 commit comments