199
199
# First, we'll show the range of each colormap. Note that some seem
200
200
# to change more "quickly" than others.
201
201
202
- nrows = max ( len (cmap_list ) for cmap_category , cmap_list in cmaps .items ())
202
+ nrows = [ len (cmap_list ) for cmap_category , cmap_list in cmaps .items ()]
203
203
gradient = np .linspace (0 , 1 , 256 )
204
204
gradient = np .vstack ((gradient , gradient ))
205
205
206
206
207
207
def plot_color_gradients (cmap_category , cmap_list , nrows ):
208
- fig , axs = plt .subplots (nrows = nrows )
208
+ fig , axs = plt .subplots (nrows = nrows , figsize = ( 6 , 0.24 * nrows ) )
209
209
fig .subplots_adjust (top = 0.95 , bottom = 0.01 , left = 0.2 , right = 0.99 )
210
210
axs [0 ].set_title (cmap_category + ' colormaps' , fontsize = 14 )
211
211
@@ -221,8 +221,8 @@ def plot_color_gradients(cmap_category, cmap_list, nrows):
221
221
ax .set_axis_off ()
222
222
223
223
224
- for cmap_category , cmap_list in cmaps .items ():
225
- plot_color_gradients (cmap_category , cmap_list , nrows )
224
+ for i , ( cmap_category , cmap_list ) in enumerate ( cmaps .items () ):
225
+ plot_color_gradients (cmap_category , cmap_list , nrows [ i ] )
226
226
227
227
plt .show ()
228
228
0 commit comments