matplotlib.cm
This module contains the instantiations of color mapping classes
-
class matplotlib.cm.ScalarMappable(norm=None, cmap=None)
This is a mixin class to support scalar -> RGBA mapping. Handles
normalization and colormapping
norm is an instance of colors.Normalize or one of
its subclasses, used to map luminance to 0-1. cmap is a
cm colormap instance, for example cm.jet
-
add_checker(checker)
- Add an entry to a dictionary of boolean flags
that are set to True when the mappable is changed.
-
autoscale()
- Autoscale the scalar limits on the norm instance using the
current array
-
autoscale_None()
- Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
-
changed()
- Call this whenever the mappable is changed to notify all the
callbackSM listeners to the ‘changed’ signal
-
check_update(checker)
- If mappable has changed since the last check,
return True; else return False
-
get_array()
- Return the array
-
get_clim()
- return the min, max of the color limits for image scaling
-
get_cmap()
- return the colormap
-
set_array(A)
- Set the image array from numpy array A
-
set_clim(vmin=None, vmax=None)
set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax) which is used to
support setp
ACCEPTS: a length 2 sequence of floats
-
set_cmap(cmap)
set the colormap for luminance data
ACCEPTS: a colormap
-
set_colorbar(im, ax)
- set the colorbar image and axes associated with mappable
-
set_norm(norm)
- set the normalization instance
-
to_rgba(x, alpha=1.0, bytes=False)
- Return a normalized rgba array corresponding to x. If x
is already an rgb array, insert alpha; if it is already
rgba, return it unchanged. If bytes is True, return rgba as
4 uint8s instead of 4 floats.
-
matplotlib.cm.get_cmap(name=None, lut=None)
- Get a colormap instance, defaulting to rc values if name is None