205205
206206
207207def plot_color_gradients (cmap_category , cmap_list , nrows ):
208- fig , axes = plt .subplots (nrows = nrows )
208+ fig , axs = plt .subplots (nrows = nrows )
209209 fig .subplots_adjust (top = 0.95 , bottom = 0.01 , left = 0.2 , right = 0.99 )
210- axes [0 ].set_title (cmap_category + ' colormaps' , fontsize = 14 )
210+ axs [0 ].set_title (cmap_category + ' colormaps' , fontsize = 14 )
211211
212- for ax , name in zip (axes , cmap_list ):
212+ for ax , name in zip (axs , cmap_list ):
213213 ax .imshow (gradient , aspect = 'auto' , cmap = plt .get_cmap (name ))
214214 pos = list (ax .get_position ().bounds )
215215 x_text = pos [0 ] - 0.01
216216 y_text = pos [1 ] + pos [3 ]/ 2.
217217 fig .text (x_text , y_text , name , va = 'center' , ha = 'right' , fontsize = 10 )
218218
219219 # Turn off *all* ticks & spines, not just the ones with colormaps.
220- for ax in axes :
220+ for ax in axs :
221221 ax .set_axis_off ()
222222
223223
@@ -258,10 +258,10 @@ def plot_color_gradients(cmap_category, cmap_list, nrows):
258258 nsubplots = int (np .ceil (len (cmap_list ) / dsub ))
259259
260260 # squeeze=False to handle similarly the case of a single subplot
261- fig , axes = plt .subplots (nrows = nsubplots , squeeze = False ,
262- figsize = (7 , 2.6 * nsubplots ))
261+ fig , axs = plt .subplots (nrows = nsubplots , squeeze = False ,
262+ figsize = (7 , 2.6 * nsubplots ))
263263
264- for i , ax in enumerate (axes .flat ):
264+ for i , ax in enumerate (axs .flat ):
265265
266266 locs = [] # locations for text labels
267267
@@ -300,7 +300,7 @@ def plot_color_gradients(cmap_category, cmap_list, nrows):
300300 # Set up the axis limits:
301301 # * the 1st subplot is used as a reference for the x-axis limits
302302 # * lightness values goes from 0 to 100 (y-axis limits)
303- ax .set_xlim (axes [0 , 0 ].get_xlim ())
303+ ax .set_xlim (axs [0 , 0 ].get_xlim ())
304304 ax .set_ylim (0.0 , 100.0 )
305305
306306 # Set up labels for colormaps
@@ -364,12 +364,12 @@ def plot_color_gradients(cmap_category, cmap_list, nrows):
364364
365365
366366def plot_color_gradients (cmap_category , cmap_list ):
367- fig , axes = plt .subplots (nrows = len (cmap_list ), ncols = 2 )
367+ fig , axs = plt .subplots (nrows = len (cmap_list ), ncols = 2 )
368368 fig .subplots_adjust (top = 0.95 , bottom = 0.01 , left = 0.2 , right = 0.99 ,
369369 wspace = 0.05 )
370370 fig .suptitle (cmap_category + ' colormaps' , fontsize = 14 , y = 1.0 , x = 0.6 )
371371
372- for ax , name in zip (axes , cmap_list ):
372+ for ax , name in zip (axs , cmap_list ):
373373
374374 # Get RGB values for colormap.
375375 rgb = cm .get_cmap (plt .get_cmap (name ))(x )[np .newaxis , :, :3 ]
@@ -387,7 +387,7 @@ def plot_color_gradients(cmap_category, cmap_list):
387387 fig .text (x_text , y_text , name , va = 'center' , ha = 'right' , fontsize = 10 )
388388
389389 # Turn off *all* ticks & spines, not just the ones with colormaps.
390- for ax in axes .flat :
390+ for ax in axs .flat :
391391 ax .set_axis_off ()
392392
393393 plt .show ()
0 commit comments