matplotlib.collections
¶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 segemnts)
matplotlib.collections.
AsteriskPolygonCollection
(numsides, rotation=0, sizes=(1, ), **kwargs)[source]¶Bases: matplotlib.collections.RegularPolyCollection
Draw a collection of regular asterisks with numsides points.
gives the area of the circle circumscribing the regular polygon in points^2
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)
offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their matplotlib.rcParams
patch
setting, in sequence form.
Example: see Lasso Demo for a complete example:
offsets = np.random.rand(20,2)
facecolors = [cm.jet(x) for x in np.random.rand(20)]
black = (0,0,0,1)
collection = RegularPolyCollection(
numsides=5, # a pentagon
rotation=0, sizes=(50,),
facecolors=facecolors,
edgecolors=(black,),
linewidths=(1,),
offsets=offsets,
transOffset=ax.transData,
)
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_numsides
()¶get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_rotation
()¶get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
()¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
BrokenBarHCollection
(xranges, yrange, **kwargs)[source]¶Bases: matplotlib.collections.PolyCollection
A collection of horizontal bars spanning yrange with a sequence of xranges.
ymin, ywidth
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)
offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their matplotlib.rcParams
patch
setting, in sequence form.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
(verts, closed=True)¶This allows one to delay initialization of the vertices.
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_verts
(verts, closed=True)¶This allows one to delay initialization of the vertices.
set_verts_and_codes
(verts, codes)¶This allows one to initialize vertices with path codes.
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
span_where
(x, ymin, ymax, where, **kwargs)[source]¶Create a BrokenBarHCollection to plot horizontal bars from over the regions in x where where is True. The bars range on the y-axis from ymin to ymax
A BrokenBarHCollection
is returned. kwargs are
passed on to the collection.
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
CircleCollection
(sizes, **kwargs)[source]¶Bases: matplotlib.collections._CollectionWithSizes
A collection of circles, drawn using splines.
sizes Gives the area of the circle in points^2
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)
offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their matplotlib.rcParams
patch
setting, in sequence form.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
()¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
Collection
(edgecolors=None, facecolors=None, linewidths=None, linestyles='solid', capstyle=None, joinstyle=None, antialiaseds=None, offsets=None, transOffset=None, norm=None, cmap=None, pickradius=5.0, hatch=None, urls=None, offset_position='screen', zorder=1, **kwargs)[source]¶Bases: matplotlib.artist.Artist
, matplotlib.cm.ScalarMappable
Base class for Collections. Must be subclassed to be usable.
All properties in a collection must be sequences or scalars; if scalars, they will be converted to sequences. The property of the ith element of the collection is:
prop[i % len(props)]
Exceptions are capstyle and joinstyle properties, these can only be set globally for the whole collection.
Keyword arguments and default values:
- edgecolors: None
- facecolors: None
- linewidths: None
- capstyle: None
- joinstyle: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- offset_position: 'screen' (default) or 'data'
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)- hatch: None
- zorder: 1
offsets and transOffset are used to translate the patch after rendering (default no offsets). If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their matplotlib.rcParams
patch
setting, in sequence form.
The use of ScalarMappable
is optional. If
the ScalarMappable
matrix _A is not None
(i.e., a call to set_array has been made), at draw time a call to
scalar mappable will be made to set the face colors.
Create a Collection
%(Collection)s
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)[source]¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_gid
()¶Returns the group id.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_label
()¶Get the label used for this artist in the legend.
get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()[source]¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_path_effects
()¶get_picker
()¶Return the picker object used by this artist.
get_rasterized
()¶Return whether the artist is to be rasterized.
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_url
()¶Returns the url.
get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)[source]¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)[source]¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)[source]¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)[source]¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)[source]¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)[source]¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)[source]¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)[source]¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)[source]¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)[source]¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)[source]¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)[source]¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)[source]¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)[source]¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_scalarmappable
()[source]¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
EllipseCollection
(widths, heights, angles, units='points', **kwargs)[source]¶Bases: matplotlib.collections.Collection
A collection of ellipses, drawn using splines.
Parameters: |
|
---|---|
Other Parameters: |
|
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
()¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
EventCollection
(positions, orientation=None, lineoffset=0, linelength=1, linewidth=None, color=None, linestyle='solid', antialiased=None, **kwargs)[source]¶Bases: matplotlib.collections.LineCollection
A collection of discrete events.
The events are given by a 1-dimensional array, usually the position of something along an axis, such as time or length. They do not have an amplitude and are displayed as vertical or horizontal parallel bars.
Parameters: |
|
---|
Examples
(Source code, png, pdf)
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= 'Artist'¶append_positions
(position)¶add one or more events at the specified positions
autoscale
()¶Autoscale the scalar limits on the norm instance using the current array
autoscale_None
()¶Autoscale the scalar limits on the norm instance using the current array, changing only limits that are None
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
extend_positions
(position)¶add one or more events at the specified positions
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_colors
()¶get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidths
()[source]¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_orientation
()[source]¶get the orientation of the event line, may be: [ 'horizontal' | 'vertical' ]
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_segments
()¶Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set the color(s) of the LineCollection.
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_orientation
(orientation=None)[source]¶set the orientation of the event line [ 'horizontal' | 'vertical' | None ] defaults to 'horizontal' if not specified or None
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
(segments)¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_segments
(segments)¶set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_verts
(segments)¶set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
switch_orientation
()[source]¶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 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
LineCollection
(segments, linewidths=None, colors=None, antialiaseds=None, linestyles='solid', offsets=None, transOffset=None, norm=None, cmap=None, pickradius=5, zorder=2, facecolors='none', **kwargs)[source]¶Bases: matplotlib.collections.Collection
All parameters must be sequences or scalars; if scalars, they will be converted to sequences. The property of the ith line segment is:
prop[i % len(props)]
i.e., the properties cycle if the len
of props is less than the
number of segments.
Parameters: |
|
---|
Notes
If linewidths, colors, or antialiaseds is None, they default to their rcParams setting, in sequence form.
If offsets and transOffset are not None, then offsets are transformed by transOffset and applied after the segments have been transformed to display coordinates.
If offsets is not None but transOffset is None, then the offsets are added to the segments before any transformation. In this case, a single offset can be specified as:
offsets=(xo,yo)
and this value will be added cumulatively to each successive segment, so as to produce a set of successively offset curves.
The use of ScalarMappable
is optional.
If the ScalarMappable
array
_A
is not None (i.e., a call to
set_array()
has been made), at
draw time a call to scalar mappable will be made to set the colors.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_colors
()¶get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_segments
()[source]¶Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)[source]¶Set the color(s) of the LineCollection.
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
(segments)¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_verts
(segments)¶set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
PatchCollection
(patches, match_original=False, **kwargs)[source]¶Bases: matplotlib.collections.Collection
A generic collection of patches.
This makes it easier to assign a color map to a heterogeneous collection of patches.
This also may improve plotting speed, since PatchCollection will draw faster than a large number of patches.
If any of edgecolors, facecolors, linewidths,
antialiaseds are None, they default to their
matplotlib.rcParams
patch setting, in sequence form.
The use of ScalarMappable
is optional.
If the ScalarMappable
matrix _A is not
None (i.e., a call to set_array has been made), at draw time a
call to scalar mappable will be made to set the face colors.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
PathCollection
(paths, sizes=None, **kwargs)[source]¶Bases: matplotlib.collections._CollectionWithSizes
This is the most basic Collection
subclass.
paths is a sequence of matplotlib.path.Path
instances.
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds are None, they default to their
matplotlib.rcParams
patch setting, in sequence form.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
PolyCollection
(verts, sizes=None, closed=True, **kwargs)[source]¶Bases: matplotlib.collections._CollectionWithSizes
verts is a sequence of ( verts0, verts1, ...) where
verts_i is a sequence of xy tuples of vertices, or an
equivalent numpy
array of shape (nv, 2).
sizes is None (default) or a sequence of floats that scale the corresponding verts_i. The scaling is applied before the Artist master transform; if the latter is an identity transform, then the overall scaling is such that if verts_i specify a unit square, then sizes_i is the area of that square in points^2. If len(sizes) < nv, the additional values will be taken cyclically from the array.
closed, when True, will explicitly close the polygon.
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds are None, they default to their
matplotlib.rcParams
patch setting, in sequence form.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
(verts, closed=True)¶This allows one to delay initialization of the vertices.
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
QuadMesh
(meshWidth, meshHeight, coordinates, antialiased=True, shading='flat', **kwargs)[source]¶Bases: matplotlib.collections.Collection
Class for the efficient drawing of a quadrilateral mesh.
A quadrilateral mesh consists of a grid of vertices. The dimensions of this array are (meshWidth + 1, meshHeight + 1). Each vertex in the mesh has a different set of "mesh coordinates" representing its position in the topology of the mesh. For any values (m, n) such that 0 <= m <= meshWidth and 0 <= n <= meshHeight, the vertices at mesh coordinates (m, n), (m, n + 1), (m + 1, n + 1), and (m + 1, n) form one of the quadrilaterals in the mesh. There are thus (meshWidth * meshHeight) quadrilaterals in the mesh. The mesh need not be regular and the polygons need not be convex.
A quadrilateral mesh is represented by a (2 x ((meshWidth + 1) *
(meshHeight + 1))) numpy array coordinates, where each row is
the x and y coordinates of one of the vertices. To define the
function that maps from a data point to its corresponding color,
use the set_cmap()
method. Each of these arrays is indexed in
row-major order by the mesh coordinates of the vertex (or the mesh
coordinates of the lower left vertex, in the case of the
colors).
For example, the first entry in coordinates is the coordinates of the vertex at mesh coordinates (0, 0), then the one at (0, 1), then at (0, 2) .. (0, meshWidth), (1, 0), (1, 1), and so on.
shading may be 'flat', or 'gouraud'
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_mesh_to_paths
(meshWidth, meshHeight, coordinates)[source]¶Converts a given mesh into a sequence of
matplotlib.path.Path
objects for easier rendering by
backends that do not directly support quadmeshes.
This function is primarily of use to backend implementers.
convert_mesh_to_triangles
(meshWidth, meshHeight, coordinates)[source]¶Converts a given mesh into a sequence of triangles, each point
with its own color. This is useful for experiments using
draw_qouraud_triangle
.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
RegularPolyCollection
(numsides, rotation=0, sizes=(1, ), **kwargs)[source]¶Bases: matplotlib.collections._CollectionWithSizes
Draw a collection of regular polygons with numsides.
gives the area of the circle circumscribing the regular polygon in points^2
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)
offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their matplotlib.rcParams
patch
setting, in sequence form.
Example: see Lasso Demo for a complete example:
offsets = np.random.rand(20,2)
facecolors = [cm.jet(x) for x in np.random.rand(20)]
black = (0,0,0,1)
collection = RegularPolyCollection(
numsides=5, # a pentagon
rotation=0, sizes=(50,),
facecolors=facecolors,
edgecolors=(black,),
linewidths=(1,),
offsets=offsets,
transOffset=ax.transData,
)
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
()¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
StarPolygonCollection
(numsides, rotation=0, sizes=(1, ), **kwargs)[source]¶Bases: matplotlib.collections.RegularPolyCollection
Draw a collection of regular stars with numsides points.
gives the area of the circle circumscribing the regular polygon in points^2
Valid Collection keyword arguments:
- edgecolors: None
- facecolors: None
- linewidths: None
- antialiaseds: None
- offsets: None
- transOffset: transforms.IdentityTransform()
- norm: None (optional for
matplotlib.cm.ScalarMappable
)- cmap: None (optional for
matplotlib.cm.ScalarMappable
)
offsets and transOffset are used to translate the patch after rendering (default no offsets)
If any of edgecolors, facecolors, linewidths, antialiaseds
are None, they default to their matplotlib.rcParams
patch
setting, in sequence form.
Example: see Lasso Demo for a complete example:
offsets = np.random.rand(20,2)
facecolors = [cm.jet(x) for x in np.random.rand(20)]
black = (0,0,0,1)
collection = RegularPolyCollection(
numsides=5, # a pentagon
rotation=0, sizes=(50,),
facecolors=facecolors,
edgecolors=(black,),
linewidths=(1,),
offsets=offsets,
transOffset=ax.transData,
)
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
draw
(renderer)¶Derived classes drawing method
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_numsides
()¶get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_paths
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_rotation
()¶get_sizes
()¶Returns the sizes of the elements in the collection. The value represents the 'area' of the element.
Returns: |
|
---|
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_paths
()¶set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sizes
(sizes, dpi=72.0)¶Set the sizes of each member of the collection.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶matplotlib.collections.
TriMesh
(triangulation, **kwargs)[source]¶Bases: matplotlib.collections.Collection
Class for the efficient drawing of a triangular mesh using Gouraud shading.
A triangular mesh is a Triangulation
object.
add_callback
(func)¶Adds a callback function that will be called whenever one of
the Artist
's properties changes.
Returns an id that is useful for removing the callback with
remove_callback()
later.
add_checker
(checker)¶Add an entry to a dictionary of boolean flags that are set to True when the mappable is changed.
aname
= '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
changed
()¶Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal
check_update
(checker)¶If mappable has changed since the last check, return True; else return False
contains
(mouseevent)¶Test whether the mouse event occurred in the collection.
Returns True | False, dict(ind=itemlist)
, where every
item in itemlist contains the event.
convert_mesh_to_paths
(tri)[source]¶Converts a given mesh into a sequence of
matplotlib.path.Path
objects for easier rendering by
backends that do not directly support meshes.
This function is primarily of use to backend implementers.
convert_xunits
(x)¶For artists in an axes, if the xaxis has units support, convert x using xaxis unit type
convert_yunits
(y)¶For artists in an axes, if the yaxis has units support, convert y using yaxis unit type
findobj
(match=None, include_self=True)¶Find artist objects.
Recursively find all Artist
instances
contained in self.
match can be
- None: return all objects contained in artist.
- function with signature
boolean = match(artist)
used to filter matches- class instance: e.g., Line2D. Only return artists of class type.
If include_self is True (default), include self in the list to be checked for a match.
format_cursor_data
(data)¶Return cursor data string formatted.
get_agg_filter
()¶Return filter function to be used for agg filter.
get_alpha
()¶Return the alpha value used for blending - not supported on all backends
get_animated
()¶Return the artist's animated state
get_array
()¶Return the array
get_capstyle
()¶get_children
()¶Return a list of the child Artist`s this
:class:`Artist
contains.
get_clim
()¶return the min, max of the color limits for image scaling
get_clip_box
()¶Return artist clipbox
get_clip_on
()¶Return whether artist uses clipping
get_clip_path
()¶Return artist clip path
get_cmap
()¶return the colormap
get_contains
()¶Return the _contains test used by the artist, or None for default.
get_cursor_data
(event)¶Get the cursor data for a given event.
get_dashes
(*args, **kwargs)¶alias for get_linestyle
get_datalim
(transData)¶get_edgecolor
()¶get_edgecolors
(*args, **kwargs)¶alias for get_edgecolor
get_facecolor
()¶get_facecolors
(*args, **kwargs)¶alias for get_facecolor
get_fill
()¶return whether fill is set
get_gid
()¶Returns the group id.
get_hatch
()¶Return the current hatching pattern.
get_in_layout
()¶Return boolean flag, True
if artist is included in layout
calculations.
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
get_joinstyle
()¶get_label
()¶Get the label used for this artist in the legend.
get_linestyle
()¶get_linestyles
(*args, **kwargs)¶alias for get_linestyle
get_linewidth
()¶get_linewidths
(*args, **kwargs)¶alias for get_linewidth
get_lw
(*args, **kwargs)¶alias for get_linewidth
get_offset_position
()¶Returns how offsets are applied for the collection. If offset_position is 'screen', the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
get_offset_transform
()¶get_offsets
()¶Return the offsets for the collection.
get_path_effects
()¶get_picker
()¶Return the picker object used by this artist.
get_pickradius
()¶get_rasterized
()¶Return whether the artist is to be rasterized.
get_sketch_params
()¶Returns the sketch parameters for the artist.
Returns: |
|
---|
get_snap
()¶Returns the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_tightbbox
(renderer)¶Like Artist.get_window_extent
, but includes any clipping.
Parameters: |
|
---|---|
Returns: |
|
get_transformed_clip_path_and_affine
()¶Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_transforms
()¶get_url
()¶Returns the url.
get_urls
()¶get_visible
()¶Return the artist's visiblity
get_window_extent
(renderer)¶Get the axes bounding box in display space. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_zorder
()¶Return the artist's zorder.
have_units
()¶Return True if units are set on the x or y axes
hitlist
(event)¶Deprecated since version 2.2: The hitlist function was deprecated in Matplotlib 2.2 and will be removed in 3.1.
List the children of the artist which contain the mouse event event.
is_figure_set
()¶Deprecated since version 2.2: artist.figure is not None
Returns whether the artist is assigned to a Figure
.
is_transform_set
()¶Returns True if Artist
has a transform explicitly
set.
mouseover
¶pchanged
()¶Fire an event when property changed, calling all of the registered callbacks.
pick
(mouseevent)¶Process pick event
each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set
pickable
()¶Return True if Artist
is pickable.
properties
()¶return a dictionary mapping property name -> value for all Artist props
remove
()¶Remove the artist from the figure if possible. The effect
will not be visible until the figure is redrawn, e.g., with
matplotlib.axes.Axes.draw_idle()
. Call
matplotlib.axes.Axes.relim()
to update the axes limits
if desired.
Note: relim()
will not see
collections even if the collection was added to axes with
autolim = True.
Note: there is no support for removing the artist's legend entry.
remove_callback
(oid)¶Remove a callback based on its id.
See also
add_callback()
set
(**kwargs)¶A property batch setter. Pass kwargs to set properties.
set_agg_filter
(filter_func)¶Set the agg filter.
Parameters: |
|
---|
set_alpha
(alpha)¶Set the alpha tranparencies of the collection. alpha must be a float or None.
Parameters: |
|
---|
set_animated
(b)¶Set the artist's animation state.
Parameters: |
|
---|
set_antialiased
(aa)¶Set the antialiasing state for rendering.
Parameters: |
|
---|
set_antialiaseds
(*args, **kwargs)¶alias for set_antialiased
set_array
(A)¶Set the image array from numpy array A.
Parameters: |
|
---|
set_capstyle
(cs)¶Set the capstyle for the collection. The capstyle can only be set globally for all elements in the collection
Parameters: |
|
---|
set_clim
(vmin=None, vmax=None)¶set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax)
which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have vmin
and vmax
kwargs.
set_clip_on
(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes which can lead to unexpected results.
Parameters: |
|
---|
set_clip_path
(path, transform=None)¶Set the artist's clip path, which may be:
Patch
(or subclass) instance; orPath
instance, in which case a
Transform
instance, which will be
applied to the path before using it for clipping, must be provided;
orNone
, to remove a previously set clipping path.For efficiency, if the path happens to be an axis-aligned rectangle,
this method will set the clipping box to the corresponding rectangle
and set the clipping path to None
.
set_cmap
(cmap)¶set the colormap for luminance data
Parameters: |
|
---|
set_color
(c)¶Set both the edgecolor and the facecolor.
See also
set_facecolor()
, set_edgecolor()
Parameters: |
|
---|
set_contains
(picker)¶Replace the contains test used by this artist. The new picker should be a callable function which determines whether the artist is hit by the mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit = True and props is a dictionary of properties you want returned with the contains test.
Parameters: |
|
---|
set_dashes
(*args, **kwargs)¶alias for set_linestyle
set_edgecolor
(c)¶Set the edgecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'face', the edge color will always be the same as the face color. If it is 'none', the patch boundary will not be drawn.
Parameters: |
|
---|
set_edgecolors
(*args, **kwargs)¶alias for set_edgecolor
set_facecolor
(c)¶Set the facecolor(s) of the collection. c can be a matplotlib color spec (all patches have same color), or a sequence of specs; if it is a sequence the patches will cycle through the sequence.
If c is 'none', the patch will not be filled.
Parameters: |
|
---|
set_facecolors
(*args, **kwargs)¶alias for set_facecolor
set_gid
(gid)¶Sets the (group) id for the artist.
Parameters: |
|
---|
set_hatch
(hatch)¶Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
Unlike other properties such as linewidth and colors, hatching can only be specified for the collection as a whole, not separately for each member.
Parameters: |
|
---|
set_in_layout
(in_layout)¶Set if artist is to be included in layout calculations,
E.g. Constrained Layout Guide,
Figure.tight_layout()
, and
fig.savefig(fname, bbox_inches='tight')
.
Parameters: |
|
---|
set_joinstyle
(js)¶Set the joinstyle for the collection. The joinstyle can only be set globally for all elements in the collection.
Parameters: |
|
---|
set_label
(s)¶Set the label to s for auto legend.
Parameters: |
|
---|
set_linestyle
(ls)¶Set the linestyle(s) for the collection.
linestyle | description |
---|---|
'-' or 'solid' |
solid line |
'--' or 'dashed' |
dashed line |
'-.' or 'dashdot' |
dash-dotted line |
':' or 'dotted' |
dotted line |
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq),
where onoffseq
is an even length tuple of on and off ink in points.
Parameters: |
|
---|
set_linestyles
(*args, **kwargs)¶alias for set_linestyle
set_linewidth
(lw)¶Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence
Parameters: |
|
---|
set_linewidths
(*args, **kwargs)¶alias for set_linewidth
set_lw
(*args, **kwargs)¶alias for set_linewidth
set_offset_position
(offset_position)¶Set how offsets are applied. If offset_position is 'screen' (default) the offset is applied after the master transform has been applied, that is, the offsets are in screen coordinates. If offset_position is 'data', the offset is applied before the master transform, i.e., the offsets are in data coordinates.
Parameters: |
|
---|
set_offsets
(offsets)¶Set the offsets for the collection. offsets can be a scalar or a sequence.
Parameters: |
|
---|
set_path_effects
(path_effects)¶Set the path effects.
Parameters: |
|
---|
set_picker
(picker)¶Set the epsilon for picking used by this artist
picker 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 it's 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.
Parameters: |
|
---|
set_pickradius
(pr)¶Set the pick radius used for containment tests.
Parameters: |
|
---|
set_rasterized
(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend's default behavior.
Parameters: |
|
---|
set_sketch_params
(scale=None, length=None, randomness=None)¶Sets the sketch parameters.
Parameters: |
|
---|
set_snap
(snap)¶Sets the snap setting which may be:
- True: snap vertices to the nearest pixel center
- False: leave vertices as-is
- None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
Parameters: |
|
---|
set_url
(url)¶Sets the url for the artist.
Parameters: |
|
---|
set_urls
(urls)¶Parameters: |
|
---|
set_visible
(b)¶Set the artist's visibility.
Parameters: |
|
---|
set_zorder
(level)¶Set the zorder for the artist. Artists with lower zorder values are drawn first.
Parameters: |
|
---|
stale
¶If the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
sticky_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 usecase is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
This attribute cannot be assigned to; however, the x
and y
lists can be modified in place as needed.
Examples
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
to_rgba
(x, alpha=None, bytes=False, norm=True)¶Return a normalized rgba array corresponding to x.
In the normal case, x is a 1-D or 2-D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
update
(props)¶Update this artist's properties from the dictionary prop.
update_from
(other)¶copy properties from other to self
update_scalarmappable
()¶If the scalar mappable array is not none, update colors from scalar data
zorder
= 0¶