Skip to content

Commit

Permalink
Always register Colormap() cmaps (even with leading underscore)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukelbd committed Oct 13, 2021
1 parent 4983b0b commit 0e93b7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions proplot/constructor.py
Expand Up @@ -685,13 +685,12 @@ def _pop_modification(key):

# Register the colormap
if name is None:
name = cmap.name # may have been modified by e.g. .shifted()
name = cmap.name # may have been modified by e.g. reversed()
else:
cmap.name = name
if not isinstance(name, str):
raise ValueError('Colormap name must be a string.')
if name and name[0] != '_':
pcolors._cmap_database[name] = cmap
pcolors._cmap_database[name] = cmap

# Save the colormap
if save:
Expand Down
2 changes: 2 additions & 0 deletions proplot/demos.py
Expand Up @@ -557,6 +557,7 @@ def show_cmaps(*args, **kwargs):
cmaps = [
cmap for cmap in pcolors._cmap_database.values()
if isinstance(cmap, pcolors.ContinuousColormap)
and not (cmap.name or '_')[:1] == '_'
]
ignore = None

Expand Down Expand Up @@ -617,6 +618,7 @@ def show_cycles(*args, **kwargs):
cycles = [
cmap for cmap in pcolors._cmap_database.values()
if isinstance(cmap, pcolors.DiscreteColormap)
and not (cmap.name or '_')[:1] == '_'
]
ignore = None

Expand Down

0 comments on commit 0e93b7f

Please sign in to comment.