matplotlib.colorizer
The Colorizer class which handles the data to color pipeline via a normalization and a colormap.
The Colorizer class which handles the data to color pipeline via a normalization and a colormap.
Colormap normalization for more details about data normalization.
Bases: object
Data to color pipeline.
This pipeline is accessible via Colorizer.to_rgba and executed via
the Colorizer.norm and Colorizer.cmap attributes.
The colormap used to color data.
The normalization used to normalize the data
Autoscale the scalar limits on the norm instance using the current array
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.
Return the values (min, max) that are mapped to the colormap limits.
Set the norm limits for image scaling.
The limits.
For scalar data, the limits may also be passed as a tuple (vmin, vmax) single positional argument.
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 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 , 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 kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the 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.
Bases: _ScalarMappable, Artist
Base class for artists that make map data to color using a colorizer.Colorizer.
The colorizer.Colorizer applies data normalization before
returning RGBA colors from a Colormap.
colorizer.ColorizerDraw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible
returns False).
RendererBase subclass.This method is overridden in the Artist subclasses.
Bases: object
Base class that contains the interface to Colorizer objects from
a ColorizingArtist or cm.ScalarMappable.
Note: This class only contain functions that interface the .colorizer
attribute. Other functions that as shared between ColorizingArtist
and cm.ScalarMappable are not included.
Autoscale the scalar limits on the norm instance using the current array
Autoscale the scalar limits on the norm instance using the current array, changing only limits that are None
The last colorbar associated with this object. May be None
Return the values (min, max) that are mapped to the colormap limits.
Return the Colormap instance.
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 NoneIf 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 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 , 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 kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the 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.
Bases: _ColorizerInterface
A mixin class to map one or multiple sets of scalar data to RGBA.
The ScalarMappable applies data normalization before returning RGBA colors from
the given Colormap.
Normalize (or subclass thereof) or str or NoneThe normalizing object which scales data, typically into the
interval [0, 1].
If a str, a Normalize subclass is dynamically generated based
on the scale with the corresponding name.
If None, norm defaults to a colors.Normalize object which
initializes its scaling based on the first data processed.
Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.
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.
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).
Set multiple properties at once.
a.set(a=A, b=B, c=C)
is equivalent to
a.set_a(A)
a.set_b(B)
a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
Supported properties are
Property
Description
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
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).
ColormapThe colormap used to map normalized data values to RGBA colors.
alphafloat or None |
bool |
array-like or None |
(vmin: float, vmax: float) |
|
bool |
Patch or (Path, Transform) or None |
|
str |
bool |
object |
bool |
|
list of |
None or bool or float or callable |
bool |
(scale: float, length: float, randomness: float) |
bool or None |
str |
bool |
float |