Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Possible values:


URLs are currently only implemented by the SVG backend. They are ignored by all other backends.


Set the zorder for the artist. Artists with lower zorder values are drawn first.


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 ScalarMappable.
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 floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. 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 pre-existing 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).


Update this artist's properties from the dict props.


Update colors from the scalar mappable array, if any.
Assign colors to edges and faces based on the array and/or colors that were directly set, as appropriate.


Bases: matplotlib.collections.RegularPolyCollection
Draw a collection of regular stars with numsides points.
The number of sides of the polygon.
The rotation of the polygon in radians.
The area of the circle circumscribing the polygon in points^2.
Forwarded to Collection.
See Lasso Demo for a complete example:
Add a callback function that will be called whenever one of the Artist's properties changes.
The callback function. It must have the signature:
where artist is the calling Artist. Return values may exist but are ignored.
The observer id associated with the callback. This id can be used for removing the callback with remove_callback later.
See also
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 Axes instance the artist resides in, or None.
Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.
The last colorbar associated with this ScalarMappable. May be None.
Test whether the mouse event occurred in the collection.
Returns bool, dict(ind=itemlist), where every item in itemlist contains the event.
Convert x using the unit type of the xaxis.
If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.
Convert y using the unit type of the yaxis.
If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Find artist objects.
Recursively find all Artist instances contained in the artist.
A filter criterion for the matches. This can be
Include self in the list to be checked for a match.
Return a string representation of data.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter.
See also
Return filter function to be used for agg filter.
Return the alpha value used for blending - not supported on all backends.
Return whether the artist is animated.
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.
Return a list of the child Artists of this Artist.
Return the values (min, max) that are mapped to the colormap limits.
Return the clipbox.
Return whether the artist uses clipping.
Return the clip path.
Return the Colormap instance.
Return the cursor data for a given event.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns None.
Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that format_cursor_data can convert the data to a string representation.
The only current use case is displaying the z-value of an AxesImage in the status bar of a plot window, while moving the mouse.
See also
Alias for get_linestyle.
Alias for get_edgecolor.
Alias for get_edgecolor.
Alias for get_facecolor.
Alias for get_facecolor.
Return the Figure instance the artist belongs to.
Return whether face is colored.
Return the group id.
Return the current hatching pattern.
Return boolean flag, True if artist is included in layout calculations.
E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').
Return the label used for this artist in the legend.
Alias for get_linestyle.
Alias for get_linewidth.
Alias for get_linestyle.
Alias for get_linewidth.
Return the Transform instance used by this artist offset.
Return the offsets for the collection.
Return the picking behavior of the artist.
The possible values are described in set_picker.
See also
Return whether the artist is to be rasterized.
Return the sizes ('areas') of the elements in the collection.
The 'area' of each element.
Return the sketch parameters for the artist.
A 3-tuple with the following elements:
Returns None if no sketch parameters were set.
Return the snap setting.
See set_snap for details.
Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).
Return the Transform instance used by this artist.
Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
Return the url.
Return a list of URLs, one for each element of the collection.
The list contains None for elements without a URL. See Hyperlinks for an example.
Return the visibility.
Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
Return the artist's zorder.
Return whether units are set on any axis.
Return whether the Artist has an explicitly set transform.
This is True after set_transform has been called.
If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it.
See also get_cursor_data(), ToolCursorPosition and NavigationToolbar2.
Call all of the registered callbacks.
This function is triggered internally when a property is changed.
See also
Process a pick event.
Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set.
See also
Return whether the artist is pickable.
See also
Return a dictionary of all the properties of the artist.
Remove the artist from the figure if possible.
The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired.
Note: relim will not see collections even if the collection was added to the axes with autolim = True.
Note: there is no support for removing the artist's legend entry.
Remove a callback based on its observer id.
See also
Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
array-like or scalar or None
animated
bool
antialiased or aa or antialiaseds
bool or list of bools
array
array-like or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clim
(vmin: float, vmax: float)
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
cmap
Colormap or str or None
color
color or list of rgba tuples
edgecolor or ec or edgecolors
color or list of colors or 'face'
facecolor or facecolors or fc
color or list of colors
figure
Figure
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or dashes or linestyles or ls
str or tuple or list thereof
linewidth or linewidths or lw
float or list of floats
norm
Normalize or None
offset_transform
Transform
offsets
(N, 2) or (2,) array-like
path_effects
AbstractPathEffect
picker
None or bool or float or callable
pickradius
float
rasterized
bool
sizes
ndarray or None
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
urls
list of str or None
visible
bool
zorder
float
Alias for set_antialiased.
Set the agg filter.
A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.
Set the alpha value used for blending - not supported on all backends.
All values must be within the 0-1 range, inclusive. Masked values and nans are not supported.
Set whether the artist is intended to be used in an animation.
If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting.
See also matplotlib.animation and Faster rendering by using blitting.
Set the antialiasing state for rendering.
Alias for set_antialiased.
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 CapStyle for the collection (for all its elements).
Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.
Set the artist's clip Bbox.
Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.
Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.
Set the colormap for luminance data.
Set both the edgecolor and the facecolor.
See also
For setting the edge or face color individually.
Alias for set_linestyle.
Alias for set_edgecolor.
Set the edgecolor(s) of the collection.
The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor.
Alias for set_edgecolor.
Set the facecolor(s) of the collection. c can be a color (all patches have same color), or a sequence of colors; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Alias for set_facecolor.
Alias for set_facecolor.
Set the Figure instance the artist belongs to.
Set the (group) id for the artist.
Set the hatching pattern
hatch can be one of:
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').
Set the JoinStyle for the collection (for all its elements).
Set a label that will be displayed in the legend.
s will be converted to a string by calling str.
Set the linestyle(s) for the collection.
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or 'dashdot'
dash-dotted line
':' or 'dotted'
dotted line
Alternatively a dash tuple of the following form can be provided:
where onoffseq is an even length tuple of on and off ink in points.
Valid values for individual linestyles include {'-', '--', '-.', ':', '', (offset, on-off-seq)}. See Line2D.set_linestyle for a complete description.
Alias for set_linestyle.
Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Alias for set_linewidth.
Alias for set_linestyle.
Alias for set_linewidth.
Set the normalization instance.
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.
Set the artist offset transform.
Set the offsets for the collection.
Set the path effects.
Define the picking behavior of the artist.
This can be one of the following:
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event:
to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.
Set the pick radius used for containment tests.
Pick radius, in points.
Force rasterized (bitmap) drawing for vector graphics output.
Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued.
This setting is ignored for pixel-based output.
See also Rasterization for vector graphics.
Set the sizes of each member of the collection.
The size to set for each element of the collection. The value is the 'area' of the element.
The dpi of the canvas.
Set the sketch parameters.
The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
The length of the wiggle along the line, in pixels (default 128.0)
The scale factor by which the length is shrunken or expanded (default 16.0)
The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.
Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Possible values:
Set the artist transform.
Set the url for the artist.
URLs are currently only implemented by the SVG backend. They are ignored by all other backends.
Set the artist's visibility.
Set the zorder for the artist. Artists with lower zorder values are drawn first.
Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
x and y sticky edge lists for autoscaling.
When performing autoscaling, if a data limit coincides with a value in the corresponding sticky_edges list, then no margin will be added--the view limit "sticks" to the edge. A typical use case is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
Moreover, margin expansion "bumps" against sticky edges and cannot cross them. For example, if the upper data limit is 1.0, the upper view limit computed by simple margin application is 1.2, but there is a sticky edge at 1.1, then the actual upper view limit will be 1.1.
This attribute cannot be assigned to; however, the x and y lists can be modified in place as needed.
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 ScalarMappable.
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 floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. 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 pre-existing 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).
Update this artist's properties from the dict props.
Copy properties from other to self.
Update colors from the scalar mappable array, if any.
Assign colors to edges and faces based on the array and/or colors that were directly set, as appropriate.


Add a callback function that will be called whenever one of the Artist's properties changes.
The callback function. It must have the signature:
where artist is the calling Artist. Return values may exist but are ignored.
The observer id associated with the callback. This id can be used for removing the callback with remove_callback later.
See also


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.


The last colorbar associated with this ScalarMappable. May be None.


Test whether the mouse event occurred in the collection.
Returns bool, dict(ind=itemlist), where every item in itemlist contains the event.


Convert x using the unit type of the xaxis.
If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.


Convert y using the unit type of the yaxis.
If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.


Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.


Find artist objects.
Recursively find all Artist instances contained in the artist.
A filter criterion for the matches. This can be
Include self in the list to be checked for a match.


Return a string representation of data.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter.
See also


Return filter function to be used for agg filter.


Return the alpha value used for blending - not supported on all backends.


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.


Return a list of the child Artists of this Artist.


Return the values (min, max) that are mapped to the colormap limits.


Return whether the artist uses clipping.


Return the cursor data for a given event.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns None.
Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that format_cursor_data can convert the data to a string representation.
The only current use case is displaying the z-value of an AxesImage in the status bar of a plot window, while moving the mouse.
See also


Return the Figure instance the artist belongs to.


Return boolean flag, True if artist is included in layout calculations.
E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


Return the label used for this artist in the legend.


Return the Transform instance used by this artist offset.


Return the picking behavior of the artist.
The possible values are described in set_picker.
See also


Return whether the artist is to be rasterized.


Return the sizes ('areas') of the elements in the collection.
The 'area' of each element.


Return the sketch parameters for the artist.
A 3-tuple with the following elements:
Returns None if no sketch parameters were set.


Return the snap setting.
See set_snap for details.


Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).


Return the Transform instance used by this artist.


Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.


Return a list of URLs, one for each element of the collection.
The list contains None for elements without a URL. See Hyperlinks for an example.


Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.


Return whether units are set on any axis.


Return whether the Artist has an explicitly set transform.
This is True after set_transform has been called.


Call all of the registered callbacks.
This function is triggered internally when a property is changed.
See also


Process a pick event.
Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set.
See also


Return whether the artist is pickable.
See also


Return a dictionary of all the properties of the artist.


Remove the artist from the figure if possible.
The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired.
Note: relim will not see collections even if the collection was added to the axes with autolim = True.
Note: there is no support for removing the artist's legend entry.


Remove a callback based on its observer id.
See also


Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
array-like or scalar or None
animated
bool
antialiased or aa or antialiaseds
bool or list of bools
array
array-like or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clim
(vmin: float, vmax: float)
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
cmap
Colormap or str or None
color
color or list of rgba tuples
edgecolor or ec or edgecolors
color or list of colors or 'face'
facecolor or facecolors or fc
color or list of colors
figure
Figure
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or dashes or linestyles or ls
str or tuple or list thereof
linewidth or linewidths or lw
float or list of floats
norm
Normalize or None
offset_transform
Transform
offsets
(N, 2) or (2,) array-like
path_effects
AbstractPathEffect
picker
None or bool or float or callable
pickradius
float
rasterized
bool
sizes
ndarray or None
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
urls
list of str or None
visible
bool
zorder
float


Set the agg filter.
A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.


Set the alpha value used for blending - not supported on all backends.
All values must be within the 0-1 range, inclusive. Masked values and nans are not supported.


Set whether the artist is intended to be used in an animation.
If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting.
See also matplotlib.animation and Faster rendering by using blitting.


Set the antialiasing state for rendering.


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 CapStyle for the collection (for all its elements).


Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.


Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.


Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.


Set both the edgecolor and the facecolor.
See also
For setting the edge or face color individually.


Set the edgecolor(s) of the collection.
The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor.


Set the facecolor(s) of the collection. c can be a color (all patches have same color), or a sequence of colors; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.


Set the Figure instance the artist belongs to.


Set the hatching pattern
hatch can be one of:
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.


Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


Set the JoinStyle for the collection (for all its elements).


Set a label that will be displayed in the legend.
s will be converted to a string by calling str.


Set the linestyle(s) for the collection.
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or 'dashdot'
dash-dotted line
':' or 'dotted'
dotted line
Alternatively a dash tuple of the following form can be provided:
where onoffseq is an even length tuple of on and off ink in points.
Valid values for individual linestyles include {'-', '--', '-.', ':', '', (offset, on-off-seq)}. See Line2D.set_linestyle for a complete description.


Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence


Set the normalization instance.
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.


Define the picking behavior of the artist.
This can be one of the following:
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event:
to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.


Set the pick radius used for containment tests.
Pick radius, in points.


Force rasterized (bitmap) drawing for vector graphics output.
Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued.
This setting is ignored for pixel-based output.
See also Rasterization for vector graphics.


Set the sizes of each member of the collection.
The size to set for each element of the collection. The value is the 'area' of the element.
The dpi of the canvas.


Set the sketch parameters.
The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
The length of the wiggle along the line, in pixels (default 128.0)
The scale factor by which the length is shrunken or expanded (default 16.0)
The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.


Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Possible values:


URLs are currently only implemented by the SVG backend. They are ignored by all other backends.


Set the zorder for the artist. Artists with lower zorder values are drawn first.


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 ScalarMappable.
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 floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. 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 pre-existing 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).


Update this artist's properties from the dict props.


Update colors from the scalar mappable array, if any.
Assign colors to edges and faces based on the array and/or colors that were directly set, as appropriate.


Bases: matplotlib.collections.Collection
Class for the efficient drawing of a triangular mesh using Gouraud shading.
A triangular mesh is a Triangulation object.
Edge color for each patch making up the collection. The special value 'face' can be passed to make the edgecolor match the facecolor.
Face color for each patch making up the collection.
Line width for each patch making up the collection.
Valid strings are ['solid', 'dashed', 'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples should be of the form:
where onoffseq is an even length tuple of on and off ink lengths in points. For examples, see Linestyles.
Style to use for capping lines for all paths in the collection. Allowed values are {'butt', 'projecting', 'round'}.
Style to use for joining lines for all paths in the collection. Allowed values are {'miter', 'round', 'bevel'}.
Whether each patch in the collection should be drawn with antialiasing.
A vector by which to translate each patch after rendering (default is no translation). The translation is performed in screen (pixel) coordinates (i.e. after the Artist's transform is applied).
A single transform which will be applied to each offsets vector before it is used.
Forwarded to ScalarMappable. The default of None means that the first draw call will set vmin and vmax using the minimum and maximum values of the data.
Forwarded to ScalarMappable. The default of None will result in rcParams["image.cmap"] (default: 'viridis') being used.
Hatching pattern to use in filled paths, if any. Valid strings are ['/', '', '|', '-', '+', 'x', 'o', 'O', '.', '*']. See Hatch style reference for the meaning of each hatch type.
If pickradius <= 0, then Collection.contains will return True whenever the test point is inside of one of the polygons formed by the control points of a Path in the Collection. On the other hand, if it is greater than 0, then we instead check if the test point is contained in a stroke of width 2*pickradius following any of the Paths in the Collection.
A URL for each patch to link to once drawn. Currently only works for the SVG backend. See Hyperlinks for examples.
The drawing order, shared by all Patches in the Collection. See Zorder Demo for all defaults and examples.
Add a callback function that will be called whenever one of the Artist's properties changes.
The callback function. It must have the signature:
where artist is the calling Artist. Return values may exist but are ignored.
The observer id associated with the callback. This id can be used for removing the callback with remove_callback later.
See also
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 Axes instance the artist resides in, or None.
Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.
The last colorbar associated with this ScalarMappable. May be None.
Test whether the mouse event occurred in the collection.
Returns bool, dict(ind=itemlist), where every item in itemlist contains the event.
Convert a given mesh into a sequence of Path objects.
This function is primarily of use to implementers of backends that do not directly support meshes.
Convert x using the unit type of the xaxis.
If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.
Convert y using the unit type of the yaxis.
If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Find artist objects.
Recursively find all Artist instances contained in the artist.
A filter criterion for the matches. This can be
Include self in the list to be checked for a match.
Return a string representation of data.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter.
See also
Return filter function to be used for agg filter.
Return the alpha value used for blending - not supported on all backends.
Return whether the artist is animated.
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.
Return a list of the child Artists of this Artist.
Return the values (min, max) that are mapped to the colormap limits.
Return the clipbox.
Return whether the artist uses clipping.
Return the clip path.
Return the Colormap instance.
Return the cursor data for a given event.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns None.
Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that format_cursor_data can convert the data to a string representation.
The only current use case is displaying the z-value of an AxesImage in the status bar of a plot window, while moving the mouse.
See also
Alias for get_linestyle.
Alias for get_edgecolor.
Alias for get_edgecolor.
Alias for get_facecolor.
Alias for get_facecolor.
Return the Figure instance the artist belongs to.
Return whether face is colored.
Return the group id.
Return the current hatching pattern.
Return boolean flag, True if artist is included in layout calculations.
E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').
Return the label used for this artist in the legend.
Alias for get_linestyle.
Alias for get_linewidth.
Alias for get_linestyle.
Alias for get_linewidth.
Return the Transform instance used by this artist offset.
Return the offsets for the collection.
Return the picking behavior of the artist.
The possible values are described in set_picker.
See also
Return whether the artist is to be rasterized.
Return the sketch parameters for the artist.
A 3-tuple with the following elements:
Returns None if no sketch parameters were set.
Return the snap setting.
See set_snap for details.
Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).
Return the Transform instance used by this artist.
Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
Return the url.
Return a list of URLs, one for each element of the collection.
The list contains None for elements without a URL. See Hyperlinks for an example.
Return the visibility.
Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
Return the artist's zorder.
Return whether units are set on any axis.
Return whether the Artist has an explicitly set transform.
This is True after set_transform has been called.
If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it.
See also get_cursor_data(), ToolCursorPosition and NavigationToolbar2.
Call all of the registered callbacks.
This function is triggered internally when a property is changed.
See also
Process a pick event.
Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set.
See also
Return whether the artist is pickable.
See also
Return a dictionary of all the properties of the artist.
Remove the artist from the figure if possible.
The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired.
Note: relim will not see collections even if the collection was added to the axes with autolim = True.
Note: there is no support for removing the artist's legend entry.
Remove a callback based on its observer id.
See also
Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
array-like or scalar or None
animated
bool
antialiased or aa or antialiaseds
bool or list of bools
array
array-like or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clim
(vmin: float, vmax: float)
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
cmap
Colormap or str or None
color
color or list of rgba tuples
edgecolor or ec or edgecolors
color or list of colors or 'face'
facecolor or facecolors or fc
color or list of colors
figure
Figure
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or dashes or linestyles or ls
str or tuple or list thereof
linewidth or linewidths or lw
float or list of floats
norm
Normalize or None
offset_transform
Transform
offsets
(N, 2) or (2,) array-like
path_effects
AbstractPathEffect
picker
None or bool or float or callable
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
urls
list of str or None
visible
bool
zorder
float
Alias for set_antialiased.
Set the agg filter.
A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.
Set the alpha value used for blending - not supported on all backends.
All values must be within the 0-1 range, inclusive. Masked values and nans are not supported.
Set whether the artist is intended to be used in an animation.
If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting.
See also matplotlib.animation and Faster rendering by using blitting.
Set the antialiasing state for rendering.
Alias for set_antialiased.
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 CapStyle for the collection (for all its elements).
Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.
Set the artist's clip Bbox.
Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.
Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.
Set the colormap for luminance data.
Set both the edgecolor and the facecolor.
See also
For setting the edge or face color individually.
Alias for set_linestyle.
Alias for set_edgecolor.
Set the edgecolor(s) of the collection.
The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor.
Alias for set_edgecolor.
Set the facecolor(s) of the collection. c can be a color (all patches have same color), or a sequence of colors; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Alias for set_facecolor.
Alias for set_facecolor.
Set the Figure instance the artist belongs to.
Set the (group) id for the artist.
Set the hatching pattern
hatch can be one of:
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').
Set the JoinStyle for the collection (for all its elements).
Set a label that will be displayed in the legend.
s will be converted to a string by calling str.
Set the linestyle(s) for the collection.
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or 'dashdot'
dash-dotted line
':' or 'dotted'
dotted line
Alternatively a dash tuple of the following form can be provided:
where onoffseq is an even length tuple of on and off ink in points.
Valid values for individual linestyles include {'-', '--', '-.', ':', '', (offset, on-off-seq)}. See Line2D.set_linestyle for a complete description.
Alias for set_linestyle.
Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Alias for set_linewidth.
Alias for set_linestyle.
Alias for set_linewidth.
Set the normalization instance.
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.
Set the artist offset transform.
Set the offsets for the collection.
Set the path effects.
Define the picking behavior of the artist.
This can be one of the following:
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event:
to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.
Set the pick radius used for containment tests.
Pick radius, in points.
Force rasterized (bitmap) drawing for vector graphics output.
Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued.
This setting is ignored for pixel-based output.
See also Rasterization for vector graphics.
Set the sketch parameters.
The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
The length of the wiggle along the line, in pixels (default 128.0)
The scale factor by which the length is shrunken or expanded (default 16.0)
The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.
Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Possible values:
Set the artist transform.
Set the url for the artist.
URLs are currently only implemented by the SVG backend. They are ignored by all other backends.
Set the artist's visibility.
Set the zorder for the artist. Artists with lower zorder values are drawn first.
Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
x and y sticky edge lists for autoscaling.
When performing autoscaling, if a data limit coincides with a value in the corresponding sticky_edges list, then no margin will be added--the view limit "sticks" to the edge. A typical use case is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
Moreover, margin expansion "bumps" against sticky edges and cannot cross them. For example, if the upper data limit is 1.0, the upper view limit computed by simple margin application is 1.2, but there is a sticky edge at 1.1, then the actual upper view limit will be 1.1.
This attribute cannot be assigned to; however, the x and y lists can be modified in place as needed.
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 ScalarMappable.
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 floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. 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 pre-existing 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).
Update this artist's properties from the dict props.
Copy properties from other to self.
Update colors from the scalar mappable array, if any.
Assign colors to edges and faces based on the array and/or colors that were directly set, as appropriate.


Add a callback function that will be called whenever one of the Artist's properties changes.
The callback function. It must have the signature:
where artist is the calling Artist. Return values may exist but are ignored.
The observer id associated with the callback. This id can be used for removing the callback with remove_callback later.
See also


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.


The last colorbar associated with this ScalarMappable. May be None.


Test whether the mouse event occurred in the collection.
Returns bool, dict(ind=itemlist), where every item in itemlist contains the event.


Convert a given mesh into a sequence of Path objects.
This function is primarily of use to implementers of backends that do not directly support meshes.


Convert x using the unit type of the xaxis.
If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.


Convert y using the unit type of the yaxis.
If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.


Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.


Find artist objects.
Recursively find all Artist instances contained in the artist.
A filter criterion for the matches. This can be
Include self in the list to be checked for a match.


Return a string representation of data.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter.
See also


Return filter function to be used for agg filter.


Return the alpha value used for blending - not supported on all backends.


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.


Return a list of the child Artists of this Artist.


Return the values (min, max) that are mapped to the colormap limits.


Return whether the artist uses clipping.


Return the cursor data for a given event.
Note
This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself.
Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns None.
Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that format_cursor_data can convert the data to a string representation.
The only current use case is displaying the z-value of an AxesImage in the status bar of a plot window, while moving the mouse.
See also


Return the Figure instance the artist belongs to.


Return boolean flag, True if artist is included in layout calculations.
E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


Return the label used for this artist in the legend.


Return the Transform instance used by this artist offset.


Return the picking behavior of the artist.
The possible values are described in set_picker.
See also


Return whether the artist is to be rasterized.


Return the sketch parameters for the artist.
A 3-tuple with the following elements:
Returns None if no sketch parameters were set.


Return the snap setting.
See set_snap for details.


Like Artist.get_window_extent, but includes any clipping.
renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())
The enclosing bounding box (in figure pixel coordinates).


Return the Transform instance used by this artist.


Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.


Return a list of URLs, one for each element of the collection.
The list contains None for elements without a URL. See Hyperlinks for an example.


Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.


Return whether units are set on any axis.


Return whether the Artist has an explicitly set transform.
This is True after set_transform has been called.


Call all of the registered callbacks.
This function is triggered internally when a property is changed.
See also


Process a pick event.
Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set.
See also


Return whether the artist is pickable.
See also


Return a dictionary of all the properties of the artist.


Remove the artist from the figure if possible.
The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired.
Note: relim will not see collections even if the collection was added to the axes with autolim = True.
Note: there is no support for removing the artist's legend entry.


Remove a callback based on its observer id.
See also


Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
array-like or scalar or None
animated
bool
antialiased or aa or antialiaseds
bool or list of bools
array
array-like or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clim
(vmin: float, vmax: float)
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
cmap
Colormap or str or None
color
color or list of rgba tuples
edgecolor or ec or edgecolors
color or list of colors or 'face'
facecolor or facecolors or fc
color or list of colors
figure
Figure
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or dashes or linestyles or ls
str or tuple or list thereof
linewidth or linewidths or lw
float or list of floats
norm
Normalize or None
offset_transform
Transform
offsets
(N, 2) or (2,) array-like
path_effects
AbstractPathEffect
picker
None or bool or float or callable
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
urls
list of str or None
visible
bool
zorder
float


Set the agg filter.
A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.


Set the alpha value used for blending - not supported on all backends.
All values must be within the 0-1 range, inclusive. Masked values and nans are not supported.


Set whether the artist is intended to be used in an animation.
If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting.
See also matplotlib.animation and Faster rendering by using blitting.


Set the antialiasing state for rendering.


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 CapStyle for the collection (for all its elements).


Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.


Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.


Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.


Set both the edgecolor and the facecolor.
See also
For setting the edge or face color individually.


Set the edgecolor(s) of the collection.
The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor.


Set the facecolor(s) of the collection. c can be a color (all patches have same color), or a sequence of colors; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.


Set the Figure instance the artist belongs to.


Set the hatching pattern
hatch can be one of:
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.


Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


Set the JoinStyle for the collection (for all its elements).


Set a label that will be displayed in the legend.
s will be converted to a string by calling str.


Set the linestyle(s) for the collection.
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or 'dashdot'
dash-dotted line
':' or 'dotted'
dotted line
Alternatively a dash tuple of the following form can be provided:
where onoffseq is an even length tuple of on and off ink in points.
Valid values for individual linestyles include {'-', '--', '-.', ':', '', (offset, on-off-seq)}. See Line2D.set_linestyle for a complete description.


Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence


Set the normalization instance.
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.


Define the picking behavior of the artist.
This can be one of the following:
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event:
to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.


Set the pick radius used for containment tests.
Pick radius, in points.


Force rasterized (bitmap) drawing for vector graphics output.
Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued.
This setting is ignored for pixel-based output.
See also Rasterization for vector graphics.


Set the sketch parameters.
The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
The length of the wiggle along the line, in pixels (default 128.0)
The scale factor by which the length is shrunken or expanded (default 16.0)
The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.


Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Possible values:


URLs are currently only implemented by the SVG backend. They are ignored by all other backends.


Set the zorder for the artist. Artists with lower zorder values are drawn first.


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 ScalarMappable.
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 floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. 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 pre-existing 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).


Update this artist's properties from the dict props.


Update colors from the scalar mappable array, if any.
Assign colors to edges and faces based on the array and/or colors that were directly set, as appropriate.


Colorbars are a visualization of the mapping from scalar values to colors. In Matplotlib they are drawn into a dedicated Axes.
Note
Colorbars are typically created through Figure.colorbar or its pyplot wrapper pyplot.colorbar, which internally use Colorbar together with make_axes_gridspec (for GridSpec-positioned axes) or make_axes (for non-GridSpec-positioned axes).
End-users most likely won't need to directly use this module's API.
Bases: object
Draw a colorbar in an existing axes.
Typically, colorbars are created using Figure.colorbar or pyplot.colorbar and associated with ScalarMappables (such as an AxesImage generated via imshow).
In order to draw a colorbar not associated with other elements in the figure, e.g. when showing a colormap by itself, one can create an empty ScalarMappable, or directly pass cmap and norm instead of mappable to Colorbar.
Useful public methods are set_label() and add_lines().
The Axes instance in which the colorbar is drawn.
The mappable whose colormap and norm will be used.
To show the under- and over- value colors, the mappable's norm should be specified as
To show the colors versus index instead of on a 0-1 scale, use:
The colormap to use. This parameter is ignored, unless mappable is None.
The normalization to use. This parameter is ignored, unless mappable is None.
The colorbar transparency between 0 (transparent) and 1 (opaque).
If unset, the colormap will be displayed on a 0-1 scale.
The Axes instance in which the colorbar is drawn.
A list of LineCollection (empty if no lines were drawn).
A LineCollection (empty if drawedges is False).
Draw lines on the colorbar.
The lines are appended to the list lines.
The positions of the lines.
Either a single color applying to all lines or one color value for each line.
Either a single linewidth applying to all lines or one linewidth for each line.
Whether to remove any previously added lines.
Alternatively, this method can also be called with the signature colorbar.add_lines(contour_set, erase=True), in which case levels, colors, and linewidths are taken from contour_set.
Calculate any free parameters based on the current cmap and norm, and do all the drawing.
Return the ticks as a list of locations.
if True return the minor ticks.
Turn the minor ticks of the colorbar off.
Turn on colorbar minor ticks.
Remove this colorbar from the figure.
If the colorbar was created with use_gridspec=True the previous gridspec is restored.
Set the transparency between 0 (transparent) and 1 (opaque).
If an array is provided, alpha will be set to None to use the transparency values associated with the colormap.
Add a label to the long axis of the colorbar.
The label text.
The location of the label.
Defaults to rcParams["xaxis.labellocation"] (default: 'center') or rcParams["yaxis.labellocation"] (default: 'center') depending on the orientation.
Keyword arguments are passed to set_xlabel / set_ylabel. Supported keywords are labelpad and Text properties.
Set tick labels.
Discouraged
The use of this method is discouraged, because of the dependency on tick positions. In most cases, you'll want to use set_ticks(positions, labels=labels) instead.
If you are using this method, you should always fix the tick positions before, e.g. by using Colorbar.set_ticks or by explicitly setting a FixedLocator on the long axis of the colorbar. Otherwise, ticks are free to move and the labels may end up in unexpected positions.
Texts for labeling each tick location in the sequence set by Colorbar.set_ticks; the number of labels must match the number of locations.
This keyword argument is ignored and will be be removed. Deprecated
If True, set minor ticks instead of major ticks.
Text properties for the labels.
Set tick locations.
List of tick locations.
List of tick labels. If not set, the labels show the data value.
If False, set the major ticks; if True, the minor ticks.
Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.
Update solid patches, lines, etc.
This is meant to be called when the norm of the image or contour plot to which this colorbar belongs changes.
If the norm on the mappable is different than before, this resets the locator and formatter for the axis, so if these have been customized, they will need to be customized again. However, if the norm only changes values of vmin, vmax or cmap then the old formatter and locator will be preserved.
Setup the ticks and ticklabels. This should not be needed by users.
alias of matplotlib.colorbar.Colorbar
Bases: matplotlib.colorbar.Colorbar
[Deprecated]
Deprecated since version 3.4:
[Deprecated] Create a colorbar on the given axes for the given mappable.
Note
This is a low-level function to turn an existing axes into a colorbar axes. Typically, you'll want to use colorbar instead, which automatically handles creation and placement of a suitable axes as well.
The Axes to turn into a colorbar.
The mappable to be described by the colorbar.
Keyword arguments are passed to the respective colorbar class.
The created colorbar instance.
Deprecated since version 3.4.
Create an Axes suitable for a colorbar.
The axes is placed in the figure of the parents axes, by resizing and repositioning parents.
The Axes to use as parents for placing the colorbar.
The location, relative to the parent axes, where the colorbar axes is created. It also determines the orientation of the colorbar (colorbars on the left and right are vertical, colorbars at the top and bottom are horizontal). If None, the location will come from the orientation if it is set (vertical colorbars on the right, horizontal ones at the bottom), or default to 'right' if orientation is unset.
The orientation of the colorbar. It is preferable to set the location of the colorbar, as that also determines the orientation; passing incompatible values for location and orientation raises an exception.
Fraction of original axes to use for colorbar.
Fraction by which to multiply the size of the colorbar.
Ratio of long to short dimensions.
The child axes.
The reduced keyword dictionary to be passed when creating the colorbar instance.
Fraction of original axes between colorbar and new image axes.
The anchor point of the colorbar axes. Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.
The anchor point of the colorbar parent axes. If False, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.
Create a SubplotBase suitable for a colorbar.
The axes is placed in the figure of the parent axes, by resizing and repositioning parent.
This function is similar to make_axes. Primary differences are
While this function is meant to be compatible with make_axes, there could be some minor differences.
The Axes to use as parent for placing the colorbar.
The location, relative to the parent axes, where the colorbar axes is created. It also determines the orientation of the colorbar (colorbars on the left and right are vertical, colorbars at the top and bottom are horizontal). If None, the location will come from the orientation if it is set (vertical colorbars on the right, horizontal ones at the bottom), or default to 'right' if orientation is unset.
The orientation of the colorbar. It is preferable to set the location of the colorbar, as that also determines the orientation; passing incompatible values for location and orientation raises an exception.
Fraction of original axes to use for colorbar.
Fraction by which to multiply the size of the colorbar.
Ratio of long to short dimensions.
The child axes.
The reduced keyword dictionary to be passed when creating the colorbar instance.
Fraction of original axes between colorbar and new image axes.
The anchor point of the colorbar axes. Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.
The anchor point of the colorbar parent axes. If False, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.


Bases: object
Draw a colorbar in an existing axes.
Typically, colorbars are created using Figure.colorbar or pyplot.colorbar and associated with ScalarMappables (such as an AxesImage generated via imshow).
In order to draw a colorbar not associated with other elements in the figure, e.g. when showing a colormap by itself, one can create an empty ScalarMappable, or directly pass cmap and norm instead of mappable to Colorbar.
Useful public methods are set_label() and add_lines().
The Axes instance in which the colorbar is drawn.
The mappable whose colormap and norm will be used.
To show the under- and over- value colors, the mappable's norm should be specified as
To show the colors versus index instead of on a 0-1 scale, use:
The colormap to use. This parameter is ignored, unless mappable is None.
The normalization to use. This parameter is ignored, unless mappable is None.
The colorbar transparency between 0 (transparent) and 1 (opaque).
If unset, the colormap will be displayed on a 0-1 scale.
The Axes instance in which the colorbar is drawn.
A list of LineCollection (empty if no lines were drawn).
A LineCollection (empty if drawedges is False).
Draw lines on the colorbar.
The lines are appended to the list lines.
The positions of the lines.
Either a single color applying to all lines or one color value for each line.
Either a single linewidth applying to all lines or one linewidth for each line.
Whether to remove any previously added lines.
Alternatively, this method can also be called with the signature colorbar.add_lines(contour_set, erase=True), in which case levels, colors, and linewidths are taken from contour_set.
Calculate any free parameters based on the current cmap and norm, and do all the drawing.
Return the ticks as a list of locations.
if True return the minor ticks.
Turn the minor ticks of the colorbar off.
Turn on colorbar minor ticks.
Remove this colorbar from the figure.
If the colorbar was created with use_gridspec=True the previous gridspec is restored.
Set the transparency between 0 (transparent) and 1 (opaque).
If an array is provided, alpha will be set to None to use the transparency values associated with the colormap.
Add a label to the long axis of the colorbar.
The label text.
The location of the label.
Defaults to rcParams["xaxis.labellocation"] (default: 'center') or rcParams["yaxis.labellocation"] (default: 'center') depending on the orientation.
Keyword arguments are passed to set_xlabel / set_ylabel. Supported keywords are labelpad and Text properties.
Set tick labels.
Discouraged
The use of this method is discouraged, because of the dependency on tick positions. In most cases, you'll want to use set_ticks(positions, labels=labels) instead.
If you are using this method, you should always fix the tick positions before, e.g. by using Colorbar.set_ticks or by explicitly setting a FixedLocator on the long axis of the colorbar. Otherwise, ticks are free to move and the labels may end up in unexpected positions.
Texts for labeling each tick location in the sequence set by Colorbar.set_ticks; the number of labels must match the number of locations.
This keyword argument is ignored and will be be removed. Deprecated
If True, set minor ticks instead of major ticks.
Text properties for the labels.
Set tick locations.
List of tick locations.
List of tick labels. If not set, the labels show the data value.
If False, set the major ticks; if True, the minor ticks.
Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.
Update solid patches, lines, etc.
This is meant to be called when the norm of the image or contour plot to which this colorbar belongs changes.
If the norm on the mappable is different than before, this resets the locator and formatter for the axis, so if these have been customized, they will need to be customized again. However, if the norm only changes values of vmin, vmax or cmap then the old formatter and locator will be preserved.
Setup the ticks and ticklabels. This should not be needed by users.


Draw lines on the colorbar.
The lines are appended to the list lines.
The positions of the lines.
Either a single color applying to all lines or one color value for each line.
Either a single linewidth applying to all lines or one linewidth for each line.
Whether to remove any previously added lines.
Alternatively, this method can also be called with the signature colorbar.add_lines(contour_set, erase=True), in which case levels, colors, and linewidths are taken from contour_set.


Calculate any free parameters based on the current cmap and norm, and do all the drawing.


Return the ticks as a list of locations.
if True return the minor ticks.


Turn the minor ticks of the colorbar off.


Remove this colorbar from the figure.
If the colorbar was created with use_gridspec=True the previous gridspec is restored.


Set the transparency between 0 (transparent) and 1 (opaque).
If an array is provided, alpha will be set to None to use the transparency values associated with the colormap.


Add a label to the long axis of the colorbar.
The label text.
The location of the label.
Defaults to rcParams["xaxis.labellocation"] (default: 'center') or rcParams["yaxis.labellocation"] (default: 'center') depending on the orientation.
Keyword arguments are passed to set_xlabel / set_ylabel. Supported keywords are labelpad and Text properties.


Set tick labels.
Discouraged
The use of this method is discouraged, because of the dependency on tick positions. In most cases, you'll want to use set_ticks(positions, labels=labels) instead.
If you are using this method, you should always fix the tick positions before, e.g. by using Colorbar.set_ticks or by explicitly setting a FixedLocator on the long axis of the colorbar. Otherwise, ticks are free to move and the labels may end up in unexpected positions.
Texts for labeling each tick location in the sequence set by Colorbar.set_ticks; the number of labels must match the number of locations.
This keyword argument is ignored and will be be removed. Deprecated
If True, set minor ticks instead of major ticks.
Text properties for the labels.


Set tick locations.
List of tick locations.
List of tick labels. If not set, the labels show the data value.
If False, set the major ticks; if True, the minor ticks.
Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.


Update solid patches, lines, etc.
This is meant to be called when the norm of the image or contour plot to which this colorbar belongs changes.
If the norm on the mappable is different than before, this resets the locator and formatter for the axis, so if these have been customized, they will need to be customized again. However, if the norm only changes values of vmin, vmax or cmap then the old formatter and locator will be preserved.


Setup the ticks and ticklabels. This should not be needed by users.


[Deprecated] Create a colorbar on the given axes for the given mappable.
Note
This is a low-level function to turn an existing axes into a colorbar axes. Typically, you'll want to use colorbar instead, which automatically handles creation and placement of a suitable axes as well.
The Axes to turn into a colorbar.
The mappable to be described by the colorbar.
Keyword arguments are passed to the respective colorbar class.
The created colorbar instance.
Deprecated since version 3.4.


Bases: matplotlib.colorbar.Colorbar
[Deprecated]
Deprecated since version 3.4:


Create an Axes suitable for a colorbar.
The axes is placed in the figure of the parents axes, by resizing and repositioning parents.
The Axes to use as parents for placing the colorbar.
The location, relative to the parent axes, where the colorbar axes is created. It also determines the orientation of the colorbar (colorbars on the left and right are vertical, colorbars at the top and bottom are horizontal). If None, the location will come from the orientation if it is set (vertical colorbars on the right, horizontal ones at the bottom), or default to 'right' if orientation is unset.
The orientation of the colorbar. It is preferable to set the location of the colorbar, as that also determines the orientation; passing incompatible values for location and orientation raises an exception.
Fraction of original axes to use for colorbar.
Fraction by which to multiply the size of the colorbar.
Ratio of long to short dimensions.
The child axes.
The reduced keyword dictionary to be passed when creating the colorbar instance.
Fraction of original axes between colorbar and new image axes.
The anchor point of the colorbar axes. Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.
The anchor point of the colorbar parent axes. If False, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.


Create a SubplotBase suitable for a colorbar.
The axes is placed in the figure of the parent axes, by resizing and repositioning parent.
This function is similar to make_axes. Primary differences are
While this function is meant to be compatible with make_axes, there could be some minor differences.
The Axes to use as parent for placing the colorbar.
The location, relative to the parent axes, where the colorbar axes is created. It also determines the orientation of the colorbar (colorbars on the left and right are vertical, colorbars at the top and bottom are horizontal). If None, the location will come from the orientation if it is set (vertical colorbars on the right, horizontal ones at the bottom), or default to 'right' if orientation is unset.
The orientation of the colorbar. It is preferable to set the location of the colorbar, as that also determines the orientation; passing incompatible values for location and orientation raises an exception.
Fraction of original axes to use for colorbar.
Fraction by which to multiply the size of the colorbar.
Ratio of long to short dimensions.
The child axes.
The reduced keyword dictionary to be passed when creating the colorbar instance.
Fraction of original axes between colorbar and new image axes.
The anchor point of the colorbar axes. Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.
The anchor point of the colorbar parent axes. If False, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.


Container for colormaps that are known to Matplotlib by name.
Experimental
While we expect the API to be final, we formally mark it as experimental for 3.5 because we want to keep the option to still adapt the API for 3.6 should the need arise.
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:
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:


Note
The Color tutorials and examples demonstrate how to set colors and colormaps. You may want to read those instead.
A module for converting numbers or color arguments to RGB or RGBA.
RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1.
This module includes functions and classes for color specification conversions, and for mapping numbers to colors in a 1-D array of colors called a colormap.
Mapping data onto colors using a colormap typically involves two steps: a data array is first mapped onto the range 0-1 using a subclass of Normalize, then this number is mapped to a color using a subclass of Colormap. Two subclasses of Colormap provided here: LinearSegmentedColormap, which uses piecewise-linear interpolation to define colormaps, and ListedColormap, which makes a colormap from a list of colors.
See also
Creating Colormaps in Matplotlib for examples of how to make colormaps and
Choosing Colormaps in Matplotlib for a list of built-in colormaps.
Colormap Normalization for more details about data normalization
More colormaps are available at palettable.
The module also provides functions for checking whether an object can be interpreted as a color (is_color_like), for converting such an object to an RGBA tuple (to_rgba) or to an HTML-like hex string in the "#rrggbb" format (to_hex), and a sequence of colors to an (n, 4) RGBA array (to_rgba_array). Caching is used for efficiency.
Colors that Matplotlib recognizes are listed at Specifying Colors.
BoundaryNorm(boundaries, ncolors[, clip, extend])
Generate a colormap index based on discrete intervals.
Colormap(name[, N])
Baseclass for all scalar to RGBA mappings.
CenteredNorm([vcenter, halfrange, clip])
Normalize symmetrical data around a center (0 by default).
LightSource([azdeg, altdeg, hsv_min_val, ...])
Create a light source coming from the specified azimuth and elevation.
LinearSegmentedColormap(name, segmentdata[, ...])
Colormap objects based on lookup tables using linear segments.
ListedColormap(colors[, name, N])
Colormap object generated from a list of colors.
LogNorm([vmin, vmax, clip])
Normalize a given value to the 0-1 range on a log scale.
NoNorm([vmin, vmax, clip])
Dummy replacement for Normalize, for the case where we want to use indices directly in a ScalarMappable.
Normalize([vmin, vmax, clip])
A class which, when called, linearly normalizes data into the [0.0, 1.0] interval.
PowerNorm(gamma[, vmin, vmax, clip])
Linearly map a given value to the 0-1 range and then apply a power-law normalization over that range.
SymLogNorm(linthresh[, linscale, vmin, ...])
The symmetrical logarithmic scale is logarithmic in both the positive and negative directions from the origin.
TwoSlopeNorm(vcenter[, vmin, vmax])
Normalize data with a set center.
FuncNorm(functions[, vmin, vmax, clip])
Arbitrary normalization using functions for the forward and inverse.
from_levels_and_colors(levels, colors[, extend])
A helper routine to generate a cmap and a norm instance which behave similar to contourf's levels and colors arguments.
hsv_to_rgb(hsv)
Convert hsv values to rgb.
rgb_to_hsv(arr)
Convert float rgb values (in the range [0, 1]), in a numpy array to hsv values.
to_hex(c[, keep_alpha])
Convert c to a hex color.
to_rgb(c)
Convert c to an RGB color, silently dropping the alpha channel.
to_rgba(c[, alpha])
Convert c to an RGBA color.
to_rgba_array(c[, alpha])
Convert c to a (n, 4) array of RGBA colors.
is_color_like(c)
Return whether c can be interpreted as an RGB(A) color.
same_color(c1, c2)
Return whether the colors c1 and c2 are the same.
get_named_colors_mapping()
Return the global mapping of names to named colors.
make_norm_from_scale(scale_cls[, ...])
Decorator for building a Normalize subclass from a ScaleBase subclass.


Bases: matplotlib.colors.Normalize
Generate a colormap index based on discrete intervals.
Unlike Normalize or LogNorm, BoundaryNorm maps values to integers instead of to the interval 0-1.
Mapping to the 0-1 interval could have been done via piece-wise linear interpolation, but using integers seems simpler, and reduces the number of conversions back and forth between integer and floating point.
Monotonically increasing sequence of at least 2 boundaries.
Number of colors in the colormap to be used.
If clip is True, out of range values are mapped to 0 if they are below boundaries[0] or mapped to ncolors - 1 if they are above boundaries[-1].
If clip is False, out of range values are mapped to -1 if they are below boundaries[0] or mapped to ncolors if they are above boundaries[-1]. These are then converted to valid indices by Colormap.__call__.
Extend the number of bins to include one or both of the regions beyond the boundaries. For example, if extend is 'min', then the color to which the region between the first pair of boundaries is mapped will be distinct from the first color in the colormap, and by default a Colorbar will be drawn with the triangle extension on the left or lower end.
boundaries defines the edges of bins, and data falling within a bin is mapped to the color with the same index.
If the number of bins, including any extensions, is less than ncolors, the color index is chosen by linear interpolation, mapping the [0, nbins - 1] range onto the [0, ncolors - 1] range.
Normalize value data in the [vmin, vmax] interval into the [0.0, 1.0] interval and return it.
Data to normalize.
If None, defaults to self.clip (which defaults to False).
If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).
BoundaryNorm is not invertible, so calling this method will always raise an error
Multicolored lines
Creating annotated heatmaps
Image Masked
pcolormesh
Left ventricle bullseye
Colormap Normalizations
Customized Colorbars Tutorial
Colormap Normalization


Normalize value data in the [vmin, vmax] interval into the [0.0, 1.0] interval and return it.
Data to normalize.
If None, defaults to self.clip (which defaults to False).
If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).


BoundaryNorm is not invertible, so calling this method will always raise an error


Bases: matplotlib.colors.Normalize
Normalize symmetrical data around a center (0 by default).
Unlike TwoSlopeNorm, CenteredNorm applies an equal rate of change around the center.
Useful when mapping symmetrical data around a conceptual center e.g., data that range from -2 to 4, with 0 as the midpoint, and with equal rates of change around that midpoint.
The data value that defines 0.5 in the normalization.
The range of data values that defines a range of 0.5 in the normalization, so that vcenter - halfrange is 0.0 and vcenter + halfrange is 1.0 in the normalization. Defaults to the largest absolute difference to vcenter for the values in the dataset.
This maps data values -2 to 0.25, 0 to 0.5, and 4 to 1.0 (assuming equal rates of change above and below 0.0):
Normalize value data in the [vmin, vmax] interval into the [0.0, 1.0] interval and return it.
Data to normalize.
If None, defaults to self.clip (which defaults to False).
If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).
Set halfrange to max(abs(A-vcenter)), then set vmin and vmax.
Set vmin and vmax.
Colormap Normalization


Set halfrange to max(abs(A-vcenter)), then set vmin and vmax.


Bases: object
Baseclass for all scalar to RGBA mappings.
Typically, Colormap instances are used to convert data values (floats) from the interval [0, 1] to the RGBA color that the respective Colormap represents. For scaling of data into the [0, 1] interval see matplotlib.colors.Normalize. Subclasses of matplotlib.cm.ScalarMappable make heavy use of this data -> normalize -> map-to-color processing chain.
The name of the colormap.
The number of rgb quantization levels.
The data value(s) to convert to RGBA. For floats, X should be in the interval [0.0, 1.0] to return the RGBA values X*100 percent along the Colormap line. For integers, X should be in the interval [0, Colormap.N) to return RGBA values indexed from the Colormap with index X.
Alpha must be a scalar between 0 and 1, a sequence of such floats with shape matching X, or None.
If False (default), the returned RGBA values will be floats in the interval [0, 1] otherwise they will be uint8s in the interval [0, 255].
When this colormap exists on a scalar mappable and colorbar_extend is not False, colorbar creation will pick up colorbar_extend as the default value for the extend keyword in the matplotlib.colorbar.Colorbar constructor.
Return a copy of the colormap.
Get the color for masked values.
Get the color for high out-of-range values.
Get the color for low out-of-range values.
Return whether the colormap is grayscale.
Return a reversed instance of the Colormap.
Note
This function is not implemented for base class.
The name for the reversed colormap. If it's None the name will be the name of the parent colormap + "_r".
See also
Set the color for masked values.
Set the colors for masked (bad) values and, when norm.clip =
False, low (under) and high (over) out-of-range values.
Set the color for high out-of-range values.
Set the color for low out-of-range values.
Return a copy of the colormap, for which the colors for masked (bad) values and, when norm.clip = False, low (under) and high (over) out-of-range values, have been set accordingly.
Multicolored lines
Creating a colormap from a list of colors
Left ventricle bullseye
Customized Colorbars Tutorial
Creating Colormaps in Matplotlib


The data value(s) to convert to RGBA. For floats, X should be in the interval [0.0, 1.0] to return the RGBA values X*100 percent along the Colormap line. For integers, X should be in the interval [0, Colormap.N) to return RGBA values indexed from the Colormap with index X.
Alpha must be a scalar between 0 and 1, a sequence of such floats with shape matching X, or None.
If False (default), the returned RGBA values will be floats in the interval [0, 1] otherwise they will be uint8s in the interval [0, 255].


When this colormap exists on a scalar mappable and colorbar_extend is not False, colorbar creation will pick up colorbar_extend as the default value for the extend keyword in the matplotlib.colorbar.Colorbar constructor.


Get the color for high out-of-range values.


Get the color for low out-of-range values.


Return whether the colormap is grayscale.


Return a reversed instance of the Colormap.
Note
This function is not implemented for base class.
The name for the reversed colormap. If it's None the name will be the name of the parent colormap + "_r".
See also


Set the colors for masked (bad) values and, when norm.clip =
False, low (under) and high (over) out-of-range values.


Set the color for high out-of-range values.


Set the color for low out-of-range values.


Return a copy of the colormap, for which the colors for masked (bad) values and, when norm.clip = False, low (under) and high (over) out-of-range values, have been set accordingly.


A helper routine to generate a cmap and a norm instance which behave similar to contourf's levels and colors arguments.
The quantization levels used to construct the BoundaryNorm. Value v is quantized to level i if lev[i] <= v < lev[i+1].
The fill color to use for each level. If extend is "neither" there must be n_level - 1 colors. For an extend of "min" or "max" add one extra color, and for an extend of "both" add two colors.
The behaviour when a value falls out of range of the given levels. See contourf for details.


Bases: matplotlib.colors.FuncNorm
Arbitrary normalization using functions for the forward and inverse.
two-tuple of the forward and inverse functions for the normalization. The forward function must be monotonic.
Both functions must have the signature
If vmin and/or vmax is not given, they are initialized from the minimum and maximum value, respectively, of the first input processed; i.e., __call__(A) calls autoscale_None(A).
If True values falling outside the range [vmin, vmax], are mapped to 0 or 1, whichever is closer, and masked values are set to 1. If False masked values remain masked.
Clipping silently defeats the purpose of setting the over, under, and masked colors in a colormap, so it is likely to lead to surprises; therefore the default is clip=False.
If vmin and/or vmax is not given, they are initialized from the minimum and maximum value, respectively, of the first input processed; i.e., __call__(A) calls autoscale_None(A).
If True values falling outside the range [vmin, vmax], are mapped to 0 or 1, whichever is closer, and masked values are set to 1. If False masked values remain masked.
Clipping silently defeats the purpose of setting the over, under, and masked colors in a colormap, so it is likely to lead to surprises; therefore the default is clip=False.
Returns 0 if vmin == vmax.
Normalize value data in the [vmin, vmax] interval into the [0.0, 1.0] interval and return it.
Data to normalize.
If None, defaults to self.clip (which defaults to False).
If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).
Colormap Normalization


Normalize value data in the [vmin, vmax] interval into the [0.0, 1.0] interval and return it.
Data to normalize.
If None, defaults to self.clip (which defaults to False).
If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).