

matplotlib.collections¶Classes for the efficient drawing of large collections of objects thatshare most properties, e.g., a large number of line segments orpolygons.
The classes are not meant to be as flexible as their single elementcounterparts (e.g., you may not be able to select all line styles) butthey are meant to be fast for common use cases (e.g., a large set of solidline segemnts)
matplotlib.collections.AsteriskPolygonCollection(numsides,rotation=0,sizes=(1,),**kwargs)¶Bases:matplotlib.collections.RegularPolyCollection
Draw a collection of regular asterisks withnumsides points.
gives the area of the circle circumscribing theregular 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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to theirmatplotlib.rcParams patchsetting, in sequence form.
Example: seeexamples/dynamic_collection.py forcomplete example:
offsets=np.random.rand(20,2)facecolors=[cm.jet(x)forxinnp.random.rand(20)]black=(0,0,0,1)collection=RegularPolyCollection(numsides=5,# a pentagonrotation=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 oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_numsides()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_rotation()¶get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.BrokenBarHCollection(xranges,yrange,**kwargs)¶Bases:matplotlib.collections.PolyCollection
A collection of horizontal bars spanningyrange with a sequence ofxranges.
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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to theirmatplotlib.rcParams patchsetting, in sequence form.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶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 visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
span_where(x,ymin,ymax,where,**kwargs)¶Create a BrokenBarHCollection to plot horizontal bars fromover the regions inx wherewhere is True. The bars rangeon the y-axis fromymin toymax
ABrokenBarHCollection is returned.kwargs arepassed on to the collection.
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.CircleCollection(sizes,**kwargs)¶Bases:matplotlib.collections._CollectionWithSizes
A collection of circles, drawn using splines.
sizesGives 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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to theirmatplotlib.rcParams patchsetting, in sequence form.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.Collection(edgecolors=None,facecolors=None,linewidths=None,linestyles='solid',antialiaseds=None,offsets=None,transOffset=None,norm=None,cmap=None,pickradius=5.0,hatch=None,urls=None,offset_position='screen',zorder=1,**kwargs)¶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. Theproperty of the ith element of the collection is:
prop[i%len(props)]
Keyword arguments and default values:
- edgecolors: None
- facecolors: None
- linewidths: 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 andtransOffset are used to translate the patch afterrendering (default no offsets). If offset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates. Ifoffset_position is ‘data’, the offset is applied before the mastertransform, i.e., the offsets are in data coordinates.
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to theirmatplotlib.rcParams patchsetting, in sequence form.
The use ofScalarMappable is optional. IftheScalarMappable matrix _A is not None(i.e., a call to set_array has been made), at draw time a call toscalar 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 oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.EllipseCollection(widths,heights,angles,units='points',**kwargs)¶Bases:matplotlib.collections.Collection
A collection of ellipses, drawn using splines.
units: [‘points’ | ‘inches’ | ‘dots’ | ‘width’ | ‘height’| ‘x’ | ‘y’ | ‘xy’]
units in which majors and minors are given; ‘width’ and‘height’ refer to the dimensions of the axes, while ‘x’and ‘y’ refer to theoffsets data units. ‘xy’ differsfrom all others in that the angle as plotted varies withthe aspect ratio, and equals the specified angle only whenthe aspect ratio is unity. Hence it behaves the same astheEllipsewithaxes.transData as its transform.
Additional kwargs inherited from the baseCollection:
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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to their
matplotlib.rcParamspatchsetting, in sequence form.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.EventCollection(positions,orientation=None,lineoffset=0,linelength=1,linewidth=None,color=None,linestyle='solid',antialiased=None,**kwargs)¶Bases:matplotlib.collections.LineCollection
A collection of discrete events.
An event is a 1-dimensional value, usually the position of something alongan axis, such as time or length. Events do not have an amplitude. Theyare displayed as v
linestyle [ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ]
Iflinewidth,color, orantialiased is None, theydefault to their rcParams setting, in sequence form.
matplotlib.cm.ScalarMappable)matplotlib.cm.ScalarMappable)pickradius is the tolerance for mouse clicks picking a line.The default is 5 pt.
The use ofScalarMappable is optional.If theScalarMappable array_A is not None (i.e., a call toset_array() has been made), atdraw time a call to scalar mappable will be made to set the colors.
Example:

add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
add_positions(position)¶add one or more events at the specified positions
aname = 'Artist'¶append_positions(position)¶add one or more events at the specified positions
autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶extend_positions(position)¶add one or more events at the specified positions
findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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_color()¶get the color of the lines used to mark each event
get_colors()¶get_contains()¶Return the _contains test used by the artist, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linelength()¶get the length of the lines used to mark each event
get_lineoffset()¶get the offset of the lines used to mark each event
get_linestyle()¶get the style of the lines used to mark each event[ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ]
get_linestyles()¶get_linewidth()¶get the width of the lines used to mark each event
get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein data coordinates.
get_offset_transform()¶get_offsets()¶Return the offsets for the collection.
get_orientation()¶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_positions()¶return an array containing the floating-point values of the positions
get_rasterized()¶return True if the artist is to be rasterized
get_segments()¶get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_horizontal()¶True if the eventcollection is horizontal, False if vertical
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set the color(s) of the line collection.c can be amatplotlib color arg (all patches have same color), or asequence or rgba tuples; if it is a sequence the patches willcycle through the sequence.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
set_linelength(linelength)¶set the length of the lines used to mark each event
set_lineoffset(lineoffset)¶set the offset of the lines used to mark each event
set_linestyle(ls)¶Set the linestyle(s) for the collection.
| 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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_orientation(orientation=None)¶set the orientation of the event line[ ‘horizontal’ | ‘vertical’ | None ]defaults to ‘horizontal’ if not specified or None
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_positions(positions)¶set the positions of the events to the specified value
set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_segments(segments)¶set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_verts(segments)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan be modified in place as needed.
Examples
>>>artist.sticky_edges.x[:]=(xmin,xmax)>>>artist.sticky_edges.y[:]=(ymin,ymax)
switch_orientation()¶switch the orientation of the event line, either from vertical tohorizontal or vice versus
to_rgba(x,alpha=None,bytes=False,norm=True)¶Return a normalized rgba array corresponding tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom 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)¶Bases:matplotlib.collections.Collection
All parameters must be sequences or scalars; if scalars, they willbe converted to sequences. The property of the ith linesegment is:
prop[i%len(props)]
i.e., the properties cycle if thelen of props is less than thenumber of segments.
a sequence of (line0,line1,line2), where:
linen=(x0,y0),(x1,y1),...(xm,ym)
or the equivalent numpy array with two columns. Each linecan be a different length.
a string or dash tuple. The dash tuple is:
(offset,onoffseq),
whereonoffseq is an even length tuple of on and off inkin points.
Iflinewidths,colors, orantialiaseds is None, theydefault to their rcParams setting, in sequence form.
Ifoffsets andtransOffset are not None, thenoffsets are transformed bytransOffset and applied afterthe segments have been transformed to display coordinates.
Ifoffsets is not None buttransOffset is None, then theoffsets 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 successivesegment, so as to produce a set of successively offset curves.
matplotlib.cm.ScalarMappable)matplotlib.cm.ScalarMappable)pickradius is the tolerance for mouse clicks picking a line.The default is 5 pt.
The use ofScalarMappable is optional.If theScalarMappable array_A is not None (i.e., a call toset_array() has been made), atdraw 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 oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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_color()¶get_colors()¶get_contains()¶Return the _contains test used by the artist, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_segments()¶get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set the color(s) of the line collection.c can be amatplotlib color arg (all patches have same color), or asequence or rgba tuples; if it is a sequence the patches willcycle through the sequence.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_segments(segments)¶set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_verts(segments)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.PatchCollection(patches,match_original=False,**kwargs)¶Bases:matplotlib.collections.Collection
A generic collection of patches.
This makes it easier to assign a color map to a heterogeneouscollection of patches.
This also may improve plotting speed, since PatchCollection willdraw faster than a large number of patches.
If any ofedgecolors,facecolors,linewidths,antialiaseds are None, they default to theirmatplotlib.rcParams patch setting, in sequence form.
The use ofScalarMappable is optional.If theScalarMappable matrix _A is notNone (i.e., a call to set_array has been made), at draw time acall to scalar mappable will be made to set the face colors.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
set_paths(patches)¶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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.PathCollection(paths,sizes=None,**kwargs)¶Bases:matplotlib.collections._CollectionWithSizes
This is the most basicCollection subclass.
paths is a sequence ofmatplotlib.path.Pathinstances.
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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to their
matplotlib.rcParamspatchsetting, in sequence form.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
set_paths(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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.PolyCollection(verts,sizes=None,closed=True,**kwargs)¶Bases:matplotlib.collections._CollectionWithSizes
verts is a sequence of (verts0,verts1, ...) whereverts_i is a sequence ofxy tuples of vertices, or anequivalentnumpy array of shape (nv, 2).
sizes isNone (default) or a sequence of floats thatscale the correspondingverts_i. The scaling is appliedbefore the Artist master transform; if the latter is an identitytransform, then the overall scaling is such that ifverts_i specify a unit square, thensizes_i is the areaof that square in points^2.If len(sizes) <nv, the additional values will betaken cyclically from the array.
closed, whenTrue, 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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to their
matplotlib.rcParamspatchsetting, in sequence form.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶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 visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.QuadMesh(meshWidth,meshHeight,coordinates,antialiased=True,shading='flat',**kwargs)¶Bases:matplotlib.collections.Collection
Class for the efficient drawing of a quadrilateral mesh.
A quadrilateral mesh consists of a grid of vertices. Thedimensions of this array are (meshWidth + 1,meshHeight +1). Each vertex in the mesh has a different set of “meshcoordinates” representing its position in the topology of themesh. For any values (m,n) such that 0 <=m <=meshWidthand 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 meshneed not be regular and the polygons need not be convex.
A quadrilateral mesh is represented by a (2 x ((meshWidth + 1) *(meshHeight + 1))) numpy arraycoordinates, where each row isthex andy coordinates of one of the vertices. To define thefunction that maps from a data point to its corresponding color,use theset_cmap() method. Each of these arrays is indexed inrow-major order by the mesh coordinates of the vertex (or the meshcoordinates of the lower left vertex, in the case of thecolors).
For example, the first entry incoordinates is thecoordinates of the vertex at mesh coordinates (0, 0), then the oneat (0, 1), then at (0, 2) .. (0, meshWidth), (1, 0), (1, 1), andso on.
shading may be ‘flat’, or ‘gouraud’
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_mesh_to_paths(meshWidth,meshHeight,coordinates)¶Converts a given mesh into a sequence ofmatplotlib.path.Path objects for easier rendering bybackends that do not directly support quadmeshes.
This function is primarily of use to backend implementers.
convert_mesh_to_triangles(meshWidth,meshHeight,coordinates)¶Converts a given mesh into a sequence of triangles, each pointwith its own color. This is useful for experiments usingdraw_qouraud_triangle.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.RegularPolyCollection(numsides,rotation=0,sizes=(1,),**kwargs)¶Bases:matplotlib.collections._CollectionWithSizes
Draw a collection of regular polygons withnumsides.
gives the area of the circle circumscribing theregular 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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to theirmatplotlib.rcParams patchsetting, in sequence form.
Example: seeexamples/dynamic_collection.py forcomplete example:
offsets=np.random.rand(20,2)facecolors=[cm.jet(x)forxinnp.random.rand(20)]black=(0,0,0,1)collection=RegularPolyCollection(numsides=5,# a pentagonrotation=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 oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_numsides()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_rotation()¶get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.StarPolygonCollection(numsides,rotation=0,sizes=(1,),**kwargs)¶Bases:matplotlib.collections.RegularPolyCollection
Draw a collection of regular stars withnumsides points.
gives the area of the circle circumscribing theregular 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 andtransOffset are used to translate the patch afterrendering (default no offsets)
If any ofedgecolors,facecolors,linewidths,antialiasedsare None, they default to theirmatplotlib.rcParams patchsetting, in sequence form.
Example: seeexamples/dynamic_collection.py forcomplete example:
offsets=np.random.rand(20,2)facecolors=[cm.jet(x)forxinnp.random.rand(20)]black=(0,0,0,1)collection=RegularPolyCollection(numsides=5,# a pentagonrotation=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 oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_xunits(x)¶For artists in an axes, if the xaxis has units support,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_numsides()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_rotation()¶get_sizes()¶Returns the sizes of the elements in the collection. Thevalue represents the ‘area’ of the element.
| Returns: | sizes : array
|
|---|
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sizes(sizes,dpi=72.0)¶Set the sizes of each member of the collection.
| Parameters: | sizes : ndarray or None
dpi : float
|
|---|
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶matplotlib.collections.TriMesh(triangulation,**kwargs)¶Bases:matplotlib.collections.Collection
Class for the efficient drawing of a triangular mesh usingGouraud shading.
A triangular mesh is aTriangulationobject.
add_callback(func)¶Adds a callback function that will be called whenever one oftheArtist‘s properties changes.
Returns anid that is useful for removing the callback withremove_callback() later.
add_checker(checker)¶Add an entry to a dictionary of boolean flagsthat are set to True when the mappable is changed.
aname = 'Artist'¶autoscale()¶Autoscale the scalar limits on the norm instance using thecurrent array
autoscale_None()¶Autoscale the scalar limits on the norm instance using thecurrent array, changing only limits that are None
changed()¶Call this whenever the mappable is changed to notify all thecallbackSM 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 everyitem in itemlist contains the event.
convert_mesh_to_paths(tri)¶Converts a given mesh into a sequence ofmatplotlib.path.Path objects for easier rendering bybackends 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,convertx using xaxis unit type
convert_yunits(y)¶For artists in an axes, if the yaxis has units support,converty using yaxis unit type
draw(artist,renderer,*args,**kwargs)¶findobj(match=None,include_self=True)¶Find artist objects.
Recursively find allArtist instancescontained 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.
Ifinclude_self is True (default), include self in the list to bechecked for a match.
format_cursor_data(data)¶Returncursor 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 allbackends
get_animated()¶Return the artist’s animated state
get_array()¶Return the array
get_axes()¶Return theAxes instance the artistresides in, orNone.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
get_children()¶Return a list of the childArtist`sthis: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, orNone for default.
get_cursor_data(event)¶Get the cursor data for a given event.
get_dashes()¶get_datalim(transData)¶get_edgecolor()¶get_edgecolors()¶get_facecolor()¶get_facecolors()¶get_fill()¶return whether fill is set
get_gid()¶Returns the group id
get_hatch()¶Return the current hatching pattern
get_label()¶Get the label used for this artist in the legend.
get_linestyle()¶get_linestyles()¶get_linewidth()¶get_linewidths()¶get_offset_position()¶Returns how offsets are applied for the collection. Ifoffset_position is ‘screen’, the offset is applied after themaster transform has been applied, that is, the offsets are inscreen coordinates. If offset_position is ‘data’, the offsetis applied before the master transform, i.e., the offsets arein 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 True if the artist is to be rasterized
get_sketch_params()¶Returns the sketch parameters for the artist.
| Returns: | sketch_params : tuple or A 3-tuple with the following elements:
May return |
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
get_transformed_clip_path_and_affine()¶Return the clip path with the non-affine part of itstransformation applied, and the remaining affine part of itstransformation.
get_transforms()¶get_url()¶Returns the url
get_urls()¶get_visible()¶Return the artist’s visiblity
get_window_extent(renderer)¶get_zorder()¶Return theArtist‘s zorder.
have_units()¶ReturnTrue if units are set on thex ory axes
hitlist(event)¶List the children of the artist which contain the mouse eventevent.
is_transform_set()¶ReturnsTrue ifArtist has a transform explicitlyset.
mouseover¶pchanged()¶Fire an event when property changed, calling all of theregistered callbacks.
pick(mouseevent)¶Process pick event
each child artist will fire a pick event ifmouseevent is overthe artist and the artist has picker set
pickable()¶ReturnTrue ifArtist is pickable.
properties()¶return a dictionary mapping property name -> value for all Artist props
remove()¶Remove the artist from the figure if possible. The effectwill not be visible until the figure is redrawn, e.g., withmatplotlib.axes.Axes.draw_idle(). Callmatplotlib.axes.Axes.relim() to update the axes limitsif desired.
Note:relim() will not seecollections even if the collection was added to axes withautolim = True.
Note: there is no support for removing the artist’s legend entry.
remove_callback(oid)¶Remove a callback based on itsid.
See also
add_callback()set(**kwargs)¶A property batch setter. Passkwargs to set properties.
set_agg_filter(filter_func)¶set agg_filter fuction.
set_alpha(alpha)¶Set the alpha tranparencies of the collection.alpha must bea float orNone.
ACCEPTS: float or None
set_animated(b)¶Set the artist’s animation state.
ACCEPTS: [True | False]
set_antialiased(aa)¶Set the antialiasing state for rendering.
ACCEPTS: Boolean or sequence of booleans
set_antialiaseds(aa)¶alias for set_antialiased
set_array(A)¶Set the image array from numpy arrayA
set_axes(axes)¶Set theAxes instance in which theartist resides, if any.
This has been deprecated in mpl 1.5, please use theaxes property. Will be removed in 1.7 or 2.0.
ACCEPTS: anAxes instance
set_clim(vmin=None,vmax=None)¶set the norm limits for image scaling; ifvmin is a length2sequence, interpret it as(vmin,vmax) which is used tosupport setp
ACCEPTS: a length 2 sequence of floats
set_clip_box(clipbox)¶Set the artist’s clipBbox.
ACCEPTS: amatplotlib.transforms.Bbox instance
set_clip_on(b)¶Set whether artist uses clipping.
When False artists will be visible out side of the axes whichcan lead to unexpected results.
ACCEPTS: [True | False]
set_clip_path(path,transform=None)¶Set the artist’s clip path, which may be:
For efficiency, if the path happens to be an axis-alignedrectangle, this method will set the clipping box to thecorresponding rectangle and set the clipping path toNone.
set_cmap(cmap)¶set the colormap for luminance data
ACCEPTS: a colormap or registered colormap name
set_color(c)¶Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
See also
set_facecolor(),set_edgecolor()set_contains(picker)¶Replace the contains test used by this artist. The new pickershould be a callable function which determines whether theartist is hit by the mouse event:
hit,props=picker(artist,mouseevent)
If the mouse event is over the artist, returnhit =Trueandprops is a dictionary of properties you want returnedwith the contains test.
ACCEPTS: a callable function
set_dashes(ls)¶alias for set_linestyle
set_edgecolor(c)¶Set the edgecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘face’, the edge color will always be the same asthe face color. If it is ‘none’, the patch boundary will notbe drawn.
ACCEPTS: matplotlib color spec or sequence of specs
set_edgecolors(c)¶alias for set_edgecolor
set_facecolor(c)¶Set the facecolor(s) of the collection.c can be amatplotlib color spec (all patches have same color), or asequence of specs; if it is a sequence the patches willcycle through the sequence.
Ifc is ‘none’, the patch will not be filled.
ACCEPTS: matplotlib color spec or sequence of specs
set_facecolors(c)¶alias for set_facecolor
set_figure(fig)¶Set theFigure instance the artistbelongs to.
ACCEPTS: amatplotlib.figure.Figure instance
set_gid(gid)¶Sets the (group) id for the artist
ACCEPTS: an id string
set_hatch(hatch)¶Set the hatching pattern
hatch can be one of:
/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars
Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
Unlike other properties such as linewidth and colors, hatchingcan only be specified for the collection as a whole, not separatelyfor each member.
ACCEPTS: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
set_label(s)¶Set the label tos for auto legend.
ACCEPTS: string or anything printable with ‘%s’ conversion.
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),
whereonoffseq is an even length tuple of on and off inkin points.
'-' |'--' |'-.' |':' |'None' |'' |'']| Parameters: | ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description
|
|---|
set_linestyles(ls)¶alias for set_linestyle
set_linewidth(lw)¶Set the linewidth(s) for the collection.lw can be a scalaror a sequence; if it is a sequence the patches will cyclethrough the sequence
ACCEPTS: float or sequence of floats
set_linewidths(lw)¶alias for set_linewidth
set_lw(lw)¶alias for set_linewidth
set_norm(norm)¶set the normalization instance
set_offset_position(offset_position)¶Set how offsets are applied. Ifoffset_position is ‘screen’(default) the offset is applied after the master transform hasbeen applied, that is, the offsets are in screen coordinates.If offset_position is ‘data’, the offset is applied before themaster transform, i.e., the offsets are in data coordinates.
set_offsets(offsets)¶Set the offsets for the collection.offsets can be a scalaror a sequence.
ACCEPTS: float or sequence of floats
set_path_effects(path_effects)¶set path_effects, which should be a list of instances ofmatplotlib.patheffect._Base class or its derivatives.
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: ifTrue then picking will be enabled and theartist will fire a pick event if the mouse event is overthe artist
A float: if picker is a number it is interpreted as anepsilon tolerance in points and the artist will fireoff an event if it’s data is within epsilon of the mouseevent. For some artists like lines and patch collections,the artist may provide additional data to the pick eventthat is generated, e.g., the indices of the data withinepsilon of the pick event
A function: if picker is callable, it is a user suppliedfunction which determines whether the artist is hit by themouse event:
hit,props=picker(artist,mouseevent)to determine the hit test. if the mouse event is over theartist, returnhit=True and props is a dictionary ofproperties you want added to the PickEvent attributes.
ACCEPTS: [None|float|boolean|callable]
set_pickradius(pr)¶set_rasterized(rasterized)¶Force rasterized (bitmap) drawing in vector backend output.
Defaults to None, which implies the backend’s default behavior
ACCEPTS: [True | False | None]
set_sketch_params(scale=None,length=None,randomness=None)¶Sets the sketch parameters.
| Parameters: | scale : float, optional
length : float, optional
randomness : float, optional
|
|---|
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 linesegments, round to the nearest pixel center
Only supported by the Agg and MacOSX backends.
set_url(url)¶Sets the url for the artist
ACCEPTS: a url string
set_urls(urls)¶set_visible(b)¶Set the artist’s visiblity.
ACCEPTS: [True | False]
set_zorder(level)¶Set the zorder for the artist. Artists with lower zordervalues are drawn first.
ACCEPTS: any number
stale¶If the artist is ‘stale’ and needs to be re-drawn for the output tomatch the internal state of the artist.
sticky_edges¶x andy sticky edge lists.
When performing autoscaling, if a data limit coincides with a value inthe corresponding sticky_edges list, then no margin will be added–theview limit “sticks” to the edge. A typical usecase is histograms,where one usually expects no margin on the bottom edge (0) of thehistogram.
This attribute cannot be assigned to; however, thex andy listscan 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 tox.
In the normal case,x is a 1-D or 2-D sequence of scalars, andthe 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 alreadyrgb or rgba, such as might have been read from an image file.Ifx is an ndarray with 3 dimensions,and the last dimension is either 3 or 4, then it will betreated as an rgb or rgba array, and no mapping will be done.If the last dimension is 3, thealpha kwarg (defaulting to 1)will be used to fill in the transparency. If the last dimensionis 4, thealpha kwarg is ignored; it does notreplace the pre-existing alpha. A ValueError will be raisedif the third dimension is other than 3 or 4.
In either case, ifbytes isFalse (default), the rgbaarray will be floats in the 0-1 range; if it isTrue,the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data isperformed, and it is assumed to already be in the range (0-1).
Note: this method assumes the input is well-behaved; it doesnot check for anomalies such asx being a masked rgbaarray, or being an integer type other than uint8, or beinga floating point rgba array with values outside the 0-1 range.
update(props)¶Update the properties of thisArtist from thedictionaryprop.
update_from(other)¶copy properties from other to self
update_scalarmappable()¶If the scalar mappable array is not none, update colorsfrom scalar data
zorder = 0¶