146146 ),
147147 'Other' : (
148148 'binary' , 'bwr' , 'brg' , # appear to be custom matplotlib
149- 'cubehelix' , 'wistia ' , 'CMRmap' , # individually released
149+ 'cubehelix' , 'Wistia ' , 'CMRmap' , # individually released
150150 'seismic' , 'terrain' , 'nipy_spectral' , # origin ambiguous
151151 'tab10' , 'tab20' , 'tab20b' , 'tab20c' , # merged colormap cycles
152152 )
@@ -3193,9 +3193,13 @@ def _draw_bars(names, *, source, unknown='User', length=4.0, width=0.2):
31933193 cmapdict = {}
31943194 names_all = list (map (str .lower , names ))
31953195 names_known = list (map (str .lower , sum (map (list , source .values ()), [])))
3196- cmapdict [unknown ] = [name for name in names if name not in names_known ]
3196+ names_unknown = [name for name in names if name not in names_known ]
3197+ if names_unknown :
3198+ cmapdict [unknown ] = names_unknown
31973199 for cat , names in source .items ():
3198- cmapdict [cat ] = [name for name in names if name .lower () in names_all ]
3200+ names_cat = [name for name in names if name .lower () in names_all ]
3201+ if names_cat :
3202+ cmapdict [cat ] = names_cat
31993203
32003204 # Draw figure
32013205 from . import subplots
@@ -3209,8 +3213,6 @@ def _draw_bars(names, *, source, unknown='User', length=4.0, width=0.2):
32093213 a = np .linspace (0 , 1 , 257 ).reshape (1 , - 1 )
32103214 a = np .vstack ((a , a ))
32113215 for cat , names in cmapdict .items ():
3212- if not names :
3213- continue
32143216 nheads += 1
32153217 for imap , name in enumerate (names ):
32163218 iax += 1
@@ -3695,9 +3697,10 @@ def show_fonts(*args, size=12, text=None):
36953697
36963698
36973699# Apply custom changes
3698- mcm .cmap_d ['Grays' ] = mcm .cmap_d .pop ('Greys' , None ) # 'Murica (and consistency with registered colors) # noqa
3699- mcm .cmap_d ['Spectral' ] = mcm .cmap_d ['Spectral' ].reversed (
3700- name = 'Spectral' ) # make spectral go from 'cold' to 'hot'
3700+ if 'Greys' in mcm .cmap_d : # 'Murica (and consistency with registered colors)
3701+ mcm .cmap_d ['Grays' ] = mcm .cmap_d .pop ('Greys' )
3702+ if 'Spectral' in mcm .cmap_d : # make spectral go from 'cold' to 'hot'
3703+ mcm .cmap_d ['Spectral' ] = mcm .cmap_d ['Spectral' ].reversed (name = 'Spectral' )
37013704for _name in CMAPS_TABLE ['Matplotlib originals' ]: # initialize as empty lists
37023705 if _name == 'twilight_shifted' :
37033706 mcm .cmap_d .pop (_name , None )
0 commit comments