Classes for the efficient drawing of large collections of objects that
share most properties, e.g., a large number of line segments or
polygons.
The classes are not meant to be as flexible as their single element
counterparts (e.g., you may not be able to select all line styles) but
they are meant to be fast for common use cases (e.g., a large set of solid
line segments).
offsets=np.random.rand(20,2)facecolors=[cm.jet(x)forxinnp.random.rand(20)]collection=RegularPolyCollection(numsides=5,# a pentagonrotation=0,sizes=(50,),facecolors=facecolors,edgecolors=("black",),linewidths=(1,),offsets=offsets,offset_transform=ax.transData,)
add_callback(func)
Add a callback function that will be called whenever one of the
Artist's properties changes.
Parameters:
func : callable
The callback function. It must have the signature:
deffunc(artist:Artist)->Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
autoscale()
Autoscale the scalar limits on the norm instance using the
current array
autoscale_None()
Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
Will typically be created from a TransformedBbox. For instance,
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes) is the default
clipping for an artist added to an Axes.
set_clip_on(b)
Set whether the artist uses clipping.
When False, artists will be visible outside the Axes which
can lead to unexpected results.
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.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
ls : {'-', '--', '-.', ':', '', ...} or (offset, on-off-seq) or list thereof
If a list, the individual elements are assigned to the elements of the
collection.
Possible values:
A string:
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
hit,props=picker(artist,mouseevent)
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_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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 Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an ndarray with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be uint8, or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the alpha kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the alpha kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the RGBA
array will be floats in the 0-1 range; if it is True,
the returned RGBA array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is
performed, and it is assumed to be in the range (0-1).
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
Base class for Collections. Must be subclassed to be usable.
A Collection represents a sequence of Patches that can be drawn
more efficiently together than individually. For example, when a single
path is being drawn repeatedly at different offsets, the renderer can
typically execute a draw_marker() call much more efficiently than a
series of repeated calls to draw_path() with the offsets put in
one-by-one.
Most properties of a collection can be configured per-element. Therefore,
Collections have "plural" versions of many of the properties of a Patch
(e.g. Collection.get_paths instead of ). Exceptions are
the , , , and properties,
which can only be set globally for the whole collection.
classmatplotlib.collections.EllipseCollection(widths, heights, angles, *, units='points', **kwargs)
The lengths of the first axes (e.g., major axis lengths).
heights : array-like
The lengths of second axes.
angles : array-like
The angles of the first axes, degrees CCW from the x-axis.
units : {'points', 'inches', 'dots', 'width', 'height', 'x', 'y', 'xy'}
The units in which majors and minors are given; 'width' and
'height' refer to the dimensions of the axes, while 'x' and 'y'
refer to the offsets data units. 'xy' differs from all others in
that the angle as plotted varies with the aspect ratio, and equals
the specified angle only when the aspect ratio is unity. Hence
it behaves the same as the Ellipse with
axes.transData as its transform.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_angles(angles)
Set the angles of the first axes, degrees CCW from the x-axis.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_widths(widths)
Set the lengths of the first axes (e.g., major axis).
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
set_picker(picker)
Define the picking behavior of the artist.
Parameters:
picker : None or bool or float or callable
This can be one of the following:
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
The amplitude of the wiggle perpendicular to the source
line, in pixels. If scale is , or not provided, no
sketch filter will be provided.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_verts(verts, closed=True)
Set the vertices of the polygons.
Parameters:
verts : list of array-like
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
set_verts_and_codes(verts, codes)
Initialize vertices with path codes.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
Represents a sequence of Line2Ds that should be drawn together.
This class extends Collection to represent a sequence of
Line2Ds instead of just a sequence of Patchs.
Just as in Collection, each property of a LineCollection may be either
a single value or a list of values. This list is then used cyclically for
each element of the LineCollection, so the property of the ith element
of the collection is:
prop[i%len(prop)]
The properties of each member of a LineCollection default to their values
in rcParams["lines.*"] instead of rcParams["patch.*"], and the property colors is
added in place of edgecolors.
Parameters:
segments : list of (N, 2) array-like
A sequence [line0,line1,...] where each line is a (N, 2)-shape
array-like containing points:
line0=[(x0,y0),(x1,y1),...]
Each line can contain a different number of points.
add_callback(func)
Add a callback function that will be called whenever one of the
Artist's properties changes.
Parameters:
func : callable
The callback function. It must have the signature:
deffunc(artist
autoscale()
Autoscale the scalar limits on the norm instance using the
current array
autoscale_None()
Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_verts(segments)
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
PatchCollection draws faster than a large number of equivalent individual
Patches. It also makes it easier to assign a colormap to a heterogeneous
collection of patches.
A sequence of Patch objects. This list may include
a heterogeneous assortment of different patch types.
match_original : bool, default: False
If True, use the colors and linewidths of the original
patches. If False, new colors may be assigned by
providing the standard collection arguments, facecolor,
edgecolor, linewidths, norm or cmap.
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their rcParams patch setting, in
sequence form.
Notes
The use of ScalarMappable functionality is optional.
If the ScalarMappable matrix _A has been set (via
a call to set_array), at draw time a call to scalar
mappable will be made to set the face colors.
add_callback(func)
Add a callback function that will be called whenever one of the
Artist's properties changes.
Parameters:
func : callable
The callback function. It must have the signature:
deffunc(artist
autoscale()
Autoscale the scalar limits on the norm instance using the
current array
autoscale_None()
Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
sizes : array-like, default: None
Squared scaling factors for the polygons. The coordinates of each
polygon verts_i are multiplied by the square-root of the
corresponding entry in sizes (i.e., sizes specify the scaling
of areas). The scaling is applied before the Artist master
transform.
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
set_picker(picker)
Define the picking behavior of the artist.
Parameters:
picker : None or bool or float or callable
This can be one of the following:
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_verts(verts, closed=True)
Set the vertices of the polygons.
Parameters:
verts : list of array-like
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
set_verts_and_codes(verts, codes)
Initialize vertices with path codes.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
Class for drawing a quadrilateral mesh as individual Polygons.
A quadrilateral mesh is a grid of M by N adjacent quadrilaterals that are
defined via a (M+1, N+1) grid of vertices. The quadrilateral (m, n) is
defined by the vertices
The mesh need not be regular and the polygons need not be convex.
Parameters:
coordinates : (M+1, N+1, 2) array-like
The vertices. coordinates[m,n] specifies the (x, y) coordinates
of vertex (m, n).
Notes
Unlike QuadMesh, this class will draw each cell as an individual Polygon.
This is significantly slower, but allows for more flexibility when wanting
to add additional properties to the cells, such as hatching.
Another difference from QuadMesh is that if any of the vertices or data
of a cell are masked, that Polygon will not be drawn and it won't be in
the list of paths returned.
Parameters:
verts : list of array-like
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
sizes : array-like, default: None
Squared scaling factors for the polygons. The coordinates of each
polygon verts_i are multiplied by the square-root of the
corresponding entry in sizes (i.e., sizes specify the scaling
of areas). The scaling is applied before the Artist master
transform.
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
Return the vertices of the mesh as an (M+1, N+1, 2) array.
M, N are the number of quadrilaterals in the rows / columns of the
mesh, corresponding to (M+1, N+1) vertices.
The last dimension specifies the components (x, y).
get_cursor_data(event)
Return the cursor data for a given event.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
(M, N) or (M*N,): a mesh with scalar data. The values are mapped
to colors using normalization and a colormap. See parameters
norm, cmap, vmin, vmax.
(M, N, 3): an image with RGB values (0-1 float or 0-255 int).
(M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
i.e. including transparency.
If the values are provided as a 2D grid, the shape must match the
coordinates grid. If the values are 1D, they are reshaped to 2D.
M, N follow from the coordinates grid, where the coordinates grid
shape is (M, N) for 'gouraud' shading and (M+1, N+1) for 'flat'
shading.
set_capstyle(cs)
Set the CapStyle for the collection (for all its elements).
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 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.
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
set_picker(picker)
Define the picking behavior of the artist.
Parameters:
picker : None or bool or float or callable
This can be one of the following:
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_verts(verts, closed=True)
Set the vertices of the polygons.
Parameters:
verts : list of array-like
The sequence of polygons [verts0, verts1, ...] where each
element verts_i defines the vertices of polygon i as a 2D
array-like of shape (M, 2).
closed : bool, default: True
Whether the polygon should be closed by adding a CLOSEPOLY
connection at the end.
set_verts_and_codes(verts, codes)
Initialize vertices with path codes.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
Class for the efficient drawing of a quadrilateral mesh.
A quadrilateral mesh is a grid of M by N adjacent quadrilaterals that are
defined via a (M+1, N+1) grid of vertices. The quadrilateral (m, n) is
defined by the vertices
The mesh need not be regular and the polygons need not be convex.
Parameters:
coordinates : (M+1, N+1, 2) array-like
The vertices. coordinates[m,n] specifies the (x, y) coordinates
of vertex (m, n).
antialiased : bool, default: True
shading : {'flat', 'gouraud'}, default: 'flat'
Notes
Unlike other Collections, the default pickradius of QuadMesh is 0,
i.e. contains checks whether the test point is within any of the
mesh quadrilaterals.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
Return the vertices of the mesh as an (M+1, N+1, 2) array.
M, N are the number of quadrilaterals in the rows / columns of the
mesh, corresponding to (M+1, N+1) vertices.
The last dimension specifies the components (x, y).
get_cursor_data(event)
Return the cursor data for a given event.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
(M, N) or (M*N,): a mesh with scalar data. The values are mapped
to colors using normalization and a colormap. See parameters
norm, cmap, vmin, vmax.
(M, N, 3): an image with RGB values (0-1 float or 0-255 int).
(M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
i.e. including transparency.
If the values are provided as a 2D grid, the shape must match the
coordinates grid. If the values are 1D, they are reshaped to 2D.
M, N follow from the coordinates grid, where the coordinates grid
shape is (M, N) for 'gouraud' shading and (M+1, N+1) for 'flat'
shading.
set_capstyle(cs)
Set the CapStyle for the collection (for all its elements).
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
The amplitude of the wiggle perpendicular to the source
line, in pixels. If scale is , or not provided, no
sketch filter will be provided.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
The amplitude of the wiggle perpendicular to the source
line, in pixels. If scale is , or not provided, no
sketch filter will be provided.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
Whether each patch in the collection should be drawn with
antialiasing.
offsets : (float, float) or list thereof, default: (0, 0)
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.
cmap, norm
Data normalization and colormapping parameters. See
ScalarMappable for a detailed description.
hatch : str, optional
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.
pickradius : float, default: 5.0
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.
urls : list of str, default: None
A URL for each patch to link to once drawn. Currently only works
for the SVG backend. See Hyperlinks for
examples.
zorder : float, default: 1
The drawing order, shared by all Patches in the Collection. See
Zorder Demo for all defaults and examples.
**kwargs
Remaining keyword arguments will be used to set properties as
Collection.set_{key}(val) for each key-value pair in kwargs.
add_callback(func)
Add a callback function that will be called whenever one of the
Artist's properties changes.
Parameters:
func : callable
The callback function. It must have the signature:
deffunc(artist
autoscale()
Autoscale the scalar limits on the norm instance using the
current array
autoscale_None()
Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
This method is overridden in the Artist subclasses.
propertyfigure
The (Sub)Figure that the artist is on. For more control, use the get_figure method.
findobj(match=None, include_self=True)
Find artist objects.
Recursively find all Artist instances contained in the artist.
Parameters:
match
A filter criterion for the matches. This can be
None: Return all objects contained in artist.
A function with signature .
The result will only contain artists for which the function
returns .
format_cursor_data(data)
Return a string representation of data.
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
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 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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
set_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
set_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Examples
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be , or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
Class for managing the two dimensional coordinates of Quadrilateral meshes
and the associated data with them. This class is a mixin and is intended to
be used with another collection that will implement the draw separately.
A quadrilateral mesh is a grid of M by N adjacent quadrilaterals that are
defined via a (M+1, N+1) grid of vertices. The quadrilateral (m, n) is
defined by the vertices
The mesh need not be regular and the polygons need not be convex.
Parameters:
coordinates : (M+1, N+1, 2) array-like
The vertices. coordinates[m,n] specifies the (x, y) coordinates
of vertex (m, n).
shading : {'flat', 'gouraud'}, default: 'flat'
set_array(A)
Set the data values.
Parameters:
A : array-like
The mesh data. Supported array shapes are:
(M, N) or (M*N,): a mesh with scalar data. The values are mapped
to colors using normalization and a colormap. See parameters
norm, cmap, vmin, vmax.
(M, N, 3): an image with RGB values (0-1 float or 0-255 int).
(M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
i.e. including transparency.
If the values are provided as a 2D grid, the shape must match the
coordinates grid. If the values are 1D, they are reshaped to 2D.
M, N follow from the coordinates grid, where the coordinates grid
shape is (M, N) for 'gouraud' shading and (M+1, N+1) for 'flat'
shading.
)
a
.
set_c
(
C
)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
Besides these exceptions, all properties can be specified as single values
(applying to all elements) or sequences of values. The property of the
ith element of the collection is:
prop[i%len(prop)]
Each Collection can optionally be used as its own ScalarMappable by
passing the norm and cmap parameters to its constructor. If the
Collection's ScalarMappable matrix _A has been set (via a call
to Collection.set_array), then at draw time this internal scalar
mappable will be used to set the facecolors and edgecolors,
ignoring those that were manually passed in.
Whether each patch in the collection should be drawn with
antialiasing.
offsets : (float, float) or list thereof, default: (0, 0)
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.
cmap, norm
Data normalization and colormapping parameters. See
ScalarMappable for a detailed description.
hatch : str, optional
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.
pickradius : float, default: 5.0
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.
urls : list of str, default: None
A URL for each patch to link to once drawn. Currently only works
for the SVG backend. See Hyperlinks for
examples.
zorder : float, default: 1
The drawing order, shared by all Patches in the Collection. See
Zorder Demo for all defaults and examples.
**kwargs
Remaining keyword arguments will be used to set properties as
Collection.set_{key}(val) for each key-value pair in kwargs.
add_callback(func)
Add a callback function that will be called whenever one of the
Artist's properties changes.
Parameters:
func : callable
The callback function. It must have the signature:
deffunc(artist:Artist)->Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
autoscale()
Autoscale the scalar limits on the norm instance using the
current array
autoscale_None()
Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
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.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
Will typically be created from a TransformedBbox. For instance,
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes) is the default
clipping for an artist added to an Axes.
set_clip_on(b)
Set whether the artist uses clipping.
When False, artists will be visible outside the Axes which
can lead to unexpected results.
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.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
ls : {'-', '--', '-.', ':', '', ...} or (offset, on-off-seq) or list thereof
If a list, the individual elements are assigned to the elements of the
collection.
Possible values:
A string:
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
hit,props=picker(artist,mouseevent)
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_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_rasterized(rasterized)
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.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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 Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an ndarray with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be uint8, or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the alpha kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the alpha kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the RGBA
array will be floats in the 0-1 range; if it is True,
the returned RGBA array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is
performed, and it is assumed to be in the range (0-1).
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
zorder=0
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_box=<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
heights=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
widths=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
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.
Return the color of the lines used to mark each event.
get_colors()
get_cursor_data(event)
Return the cursor data for a given event.
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.
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
set_alpha(alpha)
Set the alpha value used for blending - not supported on all backends.
Parameters:
alpha : array-like or float or None
All values must be within the 0-1 range, inclusive.
Masked values and nans are not supported.
set_animated(b)
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 approach is used to speed up animations
using blitting.
Will typically be created from a TransformedBbox. For instance,
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes) is the default
clipping for an artist added to an Axes.
set_clip_on(b)
Set whether the artist uses clipping.
When False, artists will be visible outside the Axes which
can lead to unexpected results.
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.
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.
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 the length of the lines used to mark each event.
set_lineoffset(lineoffset)
Set the offset of the lines used to mark each event.
set_linestyle(ls)
Set the linestyle(s) for the collection.
Parameters:
ls : {'-', '--', '-.', ':', '', ...} or (offset, on-off-seq) or list thereof
If a list, the individual elements are assigned to the elements of the
collection.
Possible values:
A string:
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
None: Picking is disabled for this artist (default).
A boolean: If True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event:
hit,props=picker(artist,mouseevent)
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_pickradius(pickradius)
Set the pick radius used for containment tests.
Parameters:
pickradius : float
Pick radius, in points.
set_positions(positions)
Set the positions of the events.
set_rasterized(rasterized)
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.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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_snap(snap)
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.
Parameters:
snap : bool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
set_verts(segments)
set_visible(b)
Set the artist's visibility.
Parameters:
b : bool
set_zorder(level)
Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters:
level : float
propertystale
Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
propertysticky_edges
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.
Switch the orientation of the event line, either from vertical to
horizontal or vice versus.
to_rgba(x, alpha=None, bytes=False, norm=True)
Return a normalized RGBA array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and
the corresponding ndarray of RGBA values will be returned,
based on the norm and colormap set for this Colorizer.
There is one special case, for handling images that are already
RGB or RGBA, such as might have been read from an image file.
If x is an ndarray with 3 dimensions,
and the last dimension is either 3 or 4, then it will be
treated as an RGB or RGBA array, and no mapping will be done.
The array can be uint8, or it can be floats with
values in the 0-1 range; otherwise a ValueError will be raised.
Any NaNs or masked elements will be set to 0 alpha.
If the last dimension is 3, the alpha kwarg (defaulting to 1)
will be used to fill in the transparency. If the last dimension
is 4, the alpha kwarg is ignored; it does not
replace the preexisting alpha. A ValueError will be raised
if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the RGBA
array will be floats in the 0-1 range; if it is True,
the returned RGBA array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is
performed, and it is assumed to be in the range (0-1).
update(props)
[Discouraged] Update this artist's properties from the dictionary props.
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
update_from(other)
Copy properties from other to self.
update_scalarmappable()
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.
zorder=0
f1
: array-like or float
The other coordinates of the nodes defining the first curve.
f2 : array-like or float
The other coordinates of the nodes defining the second curve.
where : array-like of bool, optional
Define where to exclude some {dir} regions from being filled.
The filled regions are defined by the coordinates t[where].
More precisely, fill between t[i] and t[i+1] if
where[i]andwhere[i+1]. Note that this definition implies
that an isolated True value between two False values in where
will not result in filling. Both sides of the True position
remain unfilled due to the adjacent False values.
interpolate : bool, default: False
This option is only relevant if where is used and the two curves
are crossing each other.
Semantically, where is often used for f1 > f2 or
similar. By default, the nodes of the polygon defining the filled
region will only be placed at the positions in the t array.
Such a polygon cannot describe the above semantics close to the
intersection. The t-sections containing the intersection are
simply clipped.
Setting interpolate to True will calculate the actual
intersection point and extend the filled region up to this point.
step : {{'pre', 'post', 'mid'}}, optional
Define step if the filling should be a step function,
i.e. constant in between t. The value determines where the
step will occur:
'pre': The f value is continued constantly to the left from
every t position, i.e. the interval (t[i-1],t[i]] has the
value f[i].
'post': The y value is continued constantly to the right from
every x position, i.e. the interval [t[i],t[i+1]) has the
value f[i].
'mid': Steps occur half-way between the t positions.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
data=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
verts=<UNSET>
verts_and_codes=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
For setting the facecolor, edgecolor, and hatchcolor individually.
The other coordinates of the nodes defining the first curve.
f2 : array-like or float
The other coordinates of the nodes defining the second curve.
where : array-like of bool, optional
Define where to exclude some {dir} regions from being filled.
The filled regions are defined by the coordinates t[where].
More precisely, fill between t[i] and t[i+1] if
where[i]andwhere[i+1]. Note that this definition implies
that an isolated True value between two False values in where
will not result in filling. Both sides of the True position
remain unfilled due to the adjacent False values.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
None
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
facecolors : color or list of color, default: 'none'
When setting facecolors, each line is interpreted as a boundary
for an area, implicitly closing the path from the last point to the
first point. The enclosed area is filled with facecolor.
In order to manually specify what should count as the "interior" of
each line, please use PathCollection instead, where the
"interior" can be specified by appropriate usage of
CLOSEPOLY.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
colors=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gapcolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
segments=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
verts=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
Collection
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
If "colors", the legend handles will show the different colors of
the collection. If "sizes", the legend will show the different
sizes. To set both, use kwargs to directly edit the Line2D
properties.
num : int, None, "auto" (default), array-like, or Locator
Target number of elements to create.
If None, use all unique elements of the mappable array. If an
integer, target to use num elements in the normed range.
If "auto", try to determine which option better suits the nature
of the data.
The number of created elements may slightly deviate from num due
to a Locator being used to find useful locations.
If a list or array, use exactly those elements for the legend.
Finally, a Locator can be provided.
The format or formatter to use for the labels. If a string must be
a valid input for a StrMethodFormatter. If None (the default),
use a ScalarFormatter.
func : function, default: lambdax:x
Function to calculate the labels. Often the size (or color)
argument to scatter will have been pre-processed by the
user using a function s=f(x) to make the markers visible;
e.g. size=np.log10(x). Providing the inverse of this
function here allows that pre-processing to be inverted, so that
the legend labels have the correct values; e.g. func=lambdax:10**x.
**kwargs
Allowed keyword arguments are color and size. E.g. it may be
useful to set the color of the markers if prop="sizes" is used;
similarly to set the size of the markers if prop="colors" is
used. Any further parameters are passed onto the Line2D
instance. This may be useful to e.g. specify a different
markeredgecolor or alpha for the legend handles.
Visual representation of each element of the legend.
labels : list of str
The string labels for elements of the legend.
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
verts=<UNSET>
verts_and_codes=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
verts=<UNSET>
verts_and_codes=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
'C0'
Face color for each patch making up the collection.
Whether each patch in the collection should be drawn with
antialiasing.
offsets : (float, float) or list thereof, default: (0, 0)
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.
cmap, norm
Data normalization and colormapping parameters. See
ScalarMappable for a detailed description.
hatch : str, optional
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.
pickradius : float, default: 5.0
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.
urls : list of str, default: None
A URL for each patch to link to once drawn. Currently only works
for the SVG backend. See Hyperlinks for
examples.
zorder : float, default: 1
The drawing order, shared by all Patches in the Collection. See
Zorder Demo for all defaults and examples.
**kwargs
Remaining keyword arguments will be used to set properties as
Collection.set_{key}(val) for each key-value pair in kwargs.
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
=
5
,
# a pentagon
rotation
=
0
,
sizes
=
(
50
,),
facecolors
=
facecolors
,
edgecolors
=
(
"black"
,),
linewidths
=
(
1
,),
offsets
=
offsets
,
offset_transform
=
ax
.
transData
,
)
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
None
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
=
5
,
# a pentagon
rotation
=
0
,
sizes
=
(
50
,),
facecolors
=
facecolors
,
edgecolors
=
(
"black"
,),
linewidths
=
(
1
,),
offsets
=
offsets
,
offset_transform
=
ax
.
transData
,
)
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
paths=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sizes=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
None
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
:
Artist
)
->
Any
where artist is the calling Artist. Return values may exist
but are ignored.
Returns:
int
The observer id associated with the callback. This id can be
used for removing the callback with remove_callback later.
defmatch(artist:Artist)->bool
True
A class instance: e.g., Line2D. The result will only contain
artists of this class or its subclasses (isinstance check).
include_self : bool
Include self in the list to be checked for a match.
Renderer used to draw the figure (i.e. fig.canvas.get_renderer()).
Artist.pickable
<UNSET>
clip_on=<UNSET>
clip_path=<UNSET>
cmap=<UNSET>
color=<UNSET>
edgecolor=<UNSET>
facecolor=<UNSET>
gid=<UNSET>
hatch=<UNSET>
hatch_linewidth=<UNSET>
hatchcolor=<UNSET>
in_layout=<UNSET>
joinstyle=<UNSET>
label=<UNSET>
linestyle=<UNSET>
linewidth=<UNSET>
mouseover=<UNSET>
norm=<UNSET>
offset_transform=<UNSET>
offsets=<UNSET>
path_effects=<UNSET>
picker=<UNSET>
pickradius=<UNSET>
rasterized=<UNSET>
sketch_params=<UNSET>
snap=<UNSET>
transform=<UNSET>
url=<UNSET>
urls=<UNSET>
visible=<UNSET>
zorder=<UNSET>
)
Set multiple properties at once.
a.set(a=A,b=B,c=C)
is equivalent to
a.set_a(A)a.set_b(B)a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
Parameters:
b : bool
TransformedBbox
TransformedBbox(Bbox([[0,0],[1,1]]),ax.transAxes)
TransformedPath
The clip path. If given a Path, transform must be provided as
well. If None, a previously set clip path is removed.
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.
Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.
A tuple describing the start position and lengths of dashes and spaces:
(offset, onoffseq)
where
offset is a float specifying the offset (in points); i.e. how much
is the dash pattern shifted.
onoffseq is a sequence of on and off ink in points. There can be
arbitrary many pairs of on and off values.
Example: The tuple (0,(10,5,1,5)) means that the pattern starts
at the beginning of the line. It draws a 10 point long dash,
then a 5 point long space, then a 1 point long dash, followed by a 5 point
long space, and then the pattern repeats.
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.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
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.
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).
Parameters:
props : dict
Dictionary of properties (keys) and their new values.
Returns:
list
A list of return values from the configured setters.
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
In addition to the full property names, aliases are also supported, e.g.
set(lw=2) is equivalent to set(linewidth=2), but it is an error
to pass both simultaneously.
The order of the individual setter calls matches the order of parameters
in set(). However, most properties do not depend on each other so
that order is rarely relevant.
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image