get_cmap_safe#
- get_cmap_safe(cmap: ColormapOptions) colors.Colormap[source]#
Fetch a colormap by name from matplotlib, colorcet, cmocean, or cmcrameri.
See Named Colormaps for supported colormaps.
- Parameters:
- cmap
str|list[str] |matplotlib.colors.Colormap Name of the colormap to fetch. If the input is a list of strings, the strings must be color names (from Named Colors), and it will create a
ListedColormapwith the input list.
- cmap
- Returns:
matplotlib.colors.ColormapThe requested colormap if available.
- Raises:
ValueErrorIf the input colormap name is not valid.
TypeErrorIf the input is a list of items that are not strings.