| [ Web Proxy ] |
| Viewing: https://matplotlib.org/stable/api/_as_gen/../_as_gen/../cm_api.html | [Back] [Original] |
Section Navigation
matplotlibmatplotlib.animationmatplotlib.artistmatplotlib.axesmatplotlib.axismatplotlib.backend_basesmatplotlib.backend_managersmatplotlib.backend_toolsmatplotlib.backendsmatplotlib.backends.backend_mixedmatplotlib.backends.backend_templatematplotlib.backends.backend_aggmatplotlib.backends.backend_cairomatplotlib.backends.backend_gtk3agg, matplotlib.backends.backend_gtk3cairomatplotlib.backends.backend_gtk4agg, matplotlib.backends.backend_gtk4cairomatplotlib.backends.backend_nbaggmatplotlib.backends.backend_pdfmatplotlib.backends.backend_pgfmatplotlib.backends.backend_psmatplotlib.backends.registrymatplotlib.backends.backend_qtagg, matplotlib.backends.backend_qtcairomatplotlib.backends.backend_svgmatplotlib.backends.backend_tkagg, matplotlib.backends.backend_tkcairomatplotlib.backends.backend_webagg_corematplotlib.backends.backend_webaggmatplotlib.backends.backend_wxagg, matplotlib.backends.backend_wxcairomatplotlib.beziermatplotlib.categorymatplotlib.cbookmatplotlib.cmmatplotlib.collectionsmatplotlib.colorbarmatplotlib.colorizermatplotlib.colorsmatplotlib.containermatplotlib.contourmatplotlib.datesmatplotlib.dvireadmatplotlib.figurematplotlib.font_managermatplotlib.ft2fontmatplotlib.gridspec
matplotlib.hatchmatplotlib.imagematplotlib.insetmatplotlib.layout_enginematplotlib.legendmatplotlib.legend_handlermatplotlib.lines
matplotlib.markers
matplotlib.mathtextmatplotlib.mlabmatplotlib.offsetboxmatplotlib.patchesmatplotlib.pathmatplotlib.patheffectsmatplotlib.pyplotmatplotlib.projections
matplotlib.quiver
matplotlib.rcsetupmatplotlib.sankeymatplotlib.scalematplotlib.sphinxext.mathmplmatplotlib.sphinxext.plot_directivematplotlib.sphinxext.figmpl_directivematplotlib.sphinxext.rolesmatplotlib.spinesmatplotlib.stylematplotlib.tablematplotlib.testingmatplotlib.textmatplotlib.texmanagermatplotlib.tickermatplotlib.transformsmatplotlib.trimatplotlib.typingmatplotlib.unitsmatplotlib.widgetsmatplotlib._afmmatplotlib._apimatplotlib._docstringmatplotlib._enumsmatplotlib._type1fontmatplotlib._tight_bboxmatplotlib._tight_layoutmpl_toolkits.mplot3dmpl_toolkits.axes_grid1mpl_toolkits.axisartistpylabmatplotlib.cmmatplotlib.cm#Builtin colormaps, colormap handling utilities, and the ScalarMappable mixin.
See also
Colormap reference for a list of builtin colormaps.
Creating Colormaps in Matplotlib for examples of how to make colormaps.
Choosing Colormaps in Matplotlib an in-depth discussion of choosing colormaps.
Colormap normalization for more details about data normalization.
Bases: Mapping
Container for colormaps that are known to Matplotlib by name.
The universal registry instance is matplotlib.colormaps. There should be
no need for users to instantiate ColormapRegistry themselves.
Read access uses a dict-like interface mapping names to Colormaps:
import matplotlib as mpl
cmap = mpl.colormaps['viridis']
Returned Colormaps are copies, so that their modification does not
change the global definition of the colormap.
Additional colormaps can be added via ColormapRegistry.register:
mpl.colormaps.register(my_colormap)
To get a list of all registered colormaps, you can do:
from matplotlib import colormaps
list(colormaps)
Return a color map specified through cmap.
Colormap or Noneif a Colormap, return it
if a string, look it up in mpl.colormaps
if None, return the Colormap defined in rcParams["image.cmap"] (default: 'viridis')
Register a new colormap.
The colormap name can then be used as a string argument to any cmap
parameter in Matplotlib. It is also available in pyplot.get_cmap.
The colormap registry stores a copy of the given colormap, so that future changes to the original colormap instance do not affect the registered colormap. Think of this as the registry taking a snapshot of the colormap at registration.
The colormap to register.
The name for the colormap. If not given, cmap.name is used.
If False, a ValueError is raised if trying to overwrite an already registered name. True supports overwriting registered colormaps other than the builtin colormaps.
Remove a colormap from the registry.
You cannot remove built-in colormaps.
If the named colormap is not registered, returns with no error, raises if you try to de-register a default colormap.
Warning
Colormap names are currently a shared namespace that may be used
by multiple packages. Use unregister only if you know you
have registered that name before. In particular, do not
unregister just in case to clean the name before registering a
new colormap.
The name of the colormap to be removed.
If you try to remove a default built-in colormap.
Autoscale the scalar limits on the norm instance using the current array, changing only limits that are None
Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.
The last colorbar associated with this object. May be None
Return the array of values, that are mapped to colors.
The base class ScalarMappable does not make any assumptions on
the dimensionality and shape of the array.
Set the value array from array-like A.
The values that are mapped to colors.
The base class ScalarMappable does not make any assumptions on
the dimensionality and shape of the value array A.
Set the norm limits for image scaling.
The limits.
For scalar data, the limits may also be passed as a tuple (vmin, vmax) as a single positional argument.
Set the colormap for luminance data.
Colormap or str or NoneSet the normalization instance.
Normalize or str or NoneNotes
If there are any colorbars using the mappable for this norm, setting the norm of the mappable will reset the norm, locator, and formatters on the colorbar to default.
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an ndarray with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be uint8, or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the alpha kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the alpha kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the RGBA
array will be floats in the 0-1 range; if it is True,
the returned RGBA array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
ColormapRegistry
ScalarMappableScalarMappable.autoscale()ScalarMappable.autoscale_None()ScalarMappable.changed()ScalarMappable.colorbarScalarMappable.get_alpha()ScalarMappable.get_array()ScalarMappable.get_clim()ScalarMappable.get_cmap()ScalarMappable.normScalarMappable.set_array()ScalarMappable.set_clim()ScalarMappable.set_cmap()ScalarMappable.set_norm()ScalarMappable.to_rgba()
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.0.
Built from v3.11.2-1-g879ad8ebba.
Built with the PyData Sphinx Theme 0.16.1.
| Web Proxy Viewer | New URL | Original Page |