| |
- matplotlib.patches.FancyArrowPatch(matplotlib.patches.Patch)
-
- Arrow3D
class Arrow3D(matplotlib.patches.FancyArrowPatch) |
|
Arrow3D(xs, ys, zs, *args, **kwargs)
FancyArrow3D patch for 3D arrows, by CT Zhu
http://stackoverflow.com/questions/22867620/putting-arrowheads-on-vectors-in-matplotlibs-3d-plot
Useage:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot([0,1],[0,0],[0,0],'k-')
ax.plot([0,0],[0,1],[0,0],'k-')
ax.plot([0,0],[0,0],[0,1],'k-')
v = Arrow3D([0,1],[0,1],[0,1], mutation_scale=20, lw=3, arrowstyle="-|>", color="r")
ax.add_artist(v) |
|
- Method resolution order:
- Arrow3D
- matplotlib.patches.FancyArrowPatch
- matplotlib.patches.Patch
- matplotlib.artist.Artist
- builtins.object
Methods defined here:
- __init__(self, xs, ys, zs, *args, **kwargs)
- There are two ways for defining an arrow:
- If *posA* and *posB* are given, a path connecting two points is
created according to *connectionstyle*. The path will be
clipped with *patchA* and *patchB* and further shrunken by
*shrinkA* and *shrinkB*. An arrow is drawn along this
resulting path using the *arrowstyle* parameter.
- Alternatively if *path* is provided, an arrow is drawn along this
path and *patchA*, *patchB*, *shrinkA*, and *shrinkB* are ignored.
Parameters
----------
posA, posB : (float, float), default: None
(x, y) coordinates of arrow tail and arrow head respectively.
path : `~matplotlib.path.Path`, default: None
If provided, an arrow is drawn along this path and *patchA*,
*patchB*, *shrinkA*, and *shrinkB* are ignored.
arrowstyle : str or `.ArrowStyle`, default: 'simple'
The `.ArrowStyle` with which the fancy arrow is drawn. If a
string, it should be one of the available arrowstyle names, with
optional comma-separated attributes. The optional attributes are
meant to be scaled with the *mutation_scale*. The following arrow
styles are available:
============= ========== ===============================================================================================================================
Class Name Attrs
============= ========== ===============================================================================================================================
Curve ``-`` None
CurveA ``<-`` head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=None, scaleB=None
CurveB ``->`` head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=None, scaleB=None
CurveAB ``<->`` head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=None, scaleB=None
CurveFilledA ``<|-`` head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=None, scaleB=None
CurveFilledB ``-|>`` head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=None, scaleB=None
CurveFilledAB ``<|-|>`` head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=None, scaleB=None
BracketA ``]-`` widthA=1.0, lengthA=0.2, angleA=0
BracketB ``-[`` widthB=1.0, lengthB=0.2, angleB=0
BracketAB ``]-[`` widthA=1.0, lengthA=0.2, angleA=0, widthB=1.0, lengthB=0.2, angleB=0
BarAB ``|-|`` widthA=1.0, angleA=0, widthB=1.0, angleB=0
BracketCurve ``]->`` widthA=1.0, lengthA=0.2, angleA=None
CurveBracket ``<-[`` widthB=1.0, lengthB=0.2, angleB=None
Simple ``simple`` head_length=0.5, head_width=0.5, tail_width=0.2
Fancy ``fancy`` head_length=0.4, head_width=0.4, tail_width=0.4
Wedge ``wedge`` tail_width=0.3, shrink_factor=0.5
============= ========== ===============================================================================================================================
connectionstyle : str or `.ConnectionStyle` or None, optional, default: 'arc3'
The `.ConnectionStyle` with which *posA* and *posB* are connected.
If a string, it should be one of the available connectionstyle
names, with optional comma-separated attributes. The following
connection styles are available:
====== ========== =================================================
Class Name Attrs
====== ========== =================================================
Arc3 ``arc3`` rad=0.0
Angle3 ``angle3`` angleA=90, angleB=0
Angle ``angle`` angleA=90, angleB=0, rad=0.0
Arc ``arc`` angleA=0, angleB=0, armA=None, armB=None, rad=0.0
Bar ``bar`` armA=0.0, armB=0.0, fraction=0.3, angle=None
====== ========== =================================================
patchA, patchB : `~matplotlib.patches.Patch`, default: None
Head and tail patches, respectively.
shrinkA, shrinkB : float, default: 2
Shrinking factor of the tail and head of the arrow respectively.
mutation_scale : float, default: 1
Value with which attributes of *arrowstyle* (e.g., *head_length*)
will be scaled.
mutation_aspect : None or float, default: None
The height of the rectangle will be squeezed by this value before
the mutation and the mutated box will be stretched by the inverse
of it.
Other Parameters
----------------
**kwargs : `~matplotlib.patches.Patch` properties, optional
Here is a list of available `.Patch` properties:
Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
alpha: unknown
animated: bool
antialiased or aa: bool or None
capstyle: `.CapStyle` or {'butt', 'projecting', 'round'}
clip_box: `.Bbox`
clip_on: bool
clip_path: Patch or (Path, Transform) or None
color: color
edgecolor or ec: color or None
facecolor or fc: color or None
figure: `.Figure`
fill: bool
gid: str
hatch: {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout: bool
joinstyle: `.JoinStyle` or {'miter', 'round', 'bevel'}
label: object
linestyle or ls: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw: float or None
mouseover: bool
path_effects: `.AbstractPathEffect`
picker: None or bool or float or callable
rasterized: bool
sketch_params: (scale: float, length: float, randomness: float)
snap: bool or None
transform: `.Transform`
url: str
visible: bool
zorder: float
In contrast to other patches, the default ``capstyle`` and
``joinstyle`` for `FancyArrowPatch` are set to ``"round"``.
- do_3d_projection(self, renderer=None)
- # Fix for change in matplotlib 3.5.0 (https://github.com/matplotlib/matplotlib/issues/21688)
- draw(self, renderer)
- Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (`.Artist.get_visible`
returns False).
Parameters
----------
renderer : `.RendererBase` subclass.
Notes
-----
This method is overridden in the Artist subclasses.
- set(self, *, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, arrowstyle=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, connectionstyle=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, mutation_aspect=<UNSET>, mutation_scale=<UNSET>, patchA=<UNSET>, patchB=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, positions=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)
- Set multiple properties at once.
Supported properties are
Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
alpha: scalar or None
animated: bool
antialiased or aa: bool or None
arrowstyle: str or `~matplotlib.patches.ArrowStyle`
capstyle: `.CapStyle` or {'butt', 'projecting', 'round'}
clip_box: `.Bbox`
clip_on: bool
clip_path: Patch or (Path, Transform) or None
color: color
connectionstyle: [ 'arc3' | 'angle3' | 'angle' | 'arc' | 'bar' ]
edgecolor or ec: color or None
facecolor or fc: color or None
figure: `.Figure`
fill: bool
gid: str
hatch: {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout: bool
joinstyle: `.JoinStyle` or {'miter', 'round', 'bevel'}
label: object
linestyle or ls: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw: float or None
mouseover: bool
mutation_aspect: float
mutation_scale: float
patchA: `.patches.Patch`
patchB: `.patches.Patch`
path_effects: `.AbstractPathEffect`
picker: None or bool or float or callable
positions: unknown
rasterized: bool
sketch_params: (scale: float, length: float, randomness: float)
snap: bool or None
transform: `.Transform`
url: str
visible: bool
zorder: float
Methods inherited from matplotlib.patches.FancyArrowPatch:
- __str__(self)
- Return str(self).
- get_arrowstyle(self)
- Return the arrowstyle object.
- get_connectionstyle(self)
- Return the `ConnectionStyle` used.
- get_mutation_aspect(self)
- Return the aspect ratio of the bbox mutation.
- get_mutation_scale(self)
- Return the mutation scale.
Returns
-------
scalar
- get_path(self)
- Return the path of the arrow in the data coordinates.
- set_arrowstyle(self, arrowstyle=None, **kwargs)
- Set the arrow style, possibly with further attributes.
Attributes from the previous arrow style are not reused.
Without argument (or with ``arrowstyle=None``), the available box
styles are returned as a human-readable string.
Parameters
----------
arrowstyle : str or `~matplotlib.patches.ArrowStyle`
The style of the arrow: either a `.ArrowStyle` instance, or a
string, which is the style name and optionally comma separated
attributes (e.g. "Fancy,head_length=0.2"). Such a string is used to
construct a `.ArrowStyle` object, as documented in that class.
The following arrow styles are available:
%(ArrowStyle:table_and_accepts)s
**kwargs
Additional attributes for the arrow style. See the table above for
supported parameters.
Examples
--------
::
set_arrowstyle("Fancy,head_length=0.2")
set_arrowstyle("fancy", head_length=0.2)
- set_connectionstyle(self, connectionstyle=None, **kwargs)
- Set the connection style, possibly with further attributes.
Attributes from the previous connection style are not reused.
Without argument (or with ``connectionstyle=None``), the available box
styles are returned as a human-readable string.
Parameters
----------
connectionstyle : str or `~matplotlib.patches.ConnectionStyle`
The style of the connection: either a `.ConnectionStyle` instance,
or a string, which is the style name and optionally comma separated
attributes (e.g. "Arc,armA=30,rad=10"). Such a string is used to
construct a `.ConnectionStyle` object, as documented in that class.
The following connection styles are available:
====== ========== =================================================
Class Name Attrs
====== ========== =================================================
Arc3 ``arc3`` rad=0.0
Angle3 ``angle3`` angleA=90, angleB=0
Angle ``angle`` angleA=90, angleB=0, rad=0.0
Arc ``arc`` angleA=0, angleB=0, armA=None, armB=None, rad=0.0
Bar ``bar`` armA=0.0, armB=0.0, fraction=0.3, angle=None
====== ========== =================================================
.. ACCEPTS: [ 'arc3' | 'angle3' | 'angle' | 'arc' | 'bar' ]
**kwargs
Additional attributes for the connection style. See the table above
for supported parameters.
Examples
--------
::
set_connectionstyle("Arc,armA=30,rad=10")
set_connectionstyle("arc", armA=30, rad=10)
- set_mutation_aspect(self, aspect)
- Set the aspect ratio of the bbox mutation.
Parameters
----------
aspect : float
- set_mutation_scale(self, scale)
- Set the mutation scale.
Parameters
----------
scale : float
- set_patchA(self, patchA)
- Set the tail patch.
Parameters
----------
patchA : `.patches.Patch`
- set_patchB(self, patchB)
- Set the head patch.
Parameters
----------
patchB : `.patches.Patch`
- set_positions(self, posA, posB)
- Set the start and end positions of the connecting path.
Parameters
----------
posA, posB : None, tuple
(x, y) coordinates of arrow tail and arrow head respectively. If
`None` use current value.
Methods inherited from matplotlib.patches.Patch:
- contains(self, mouseevent, radius=None)
- Test whether the mouse event occurred in the patch.
Returns
-------
(bool, empty dict)
- contains_point(self, point, radius=None)
- Return whether the given point is inside the patch.
Parameters
----------
point : (float, float)
The point (x, y) to check, in target coordinates of
``self.get_transform()``. These are display coordinates for patches
that are added to a figure or axes.
radius : float, optional
Additional margin on the patch in target coordinates of
``self.get_transform()``. See `.Path.contains_point` for further
details.
Returns
-------
bool
Notes
-----
The proper use of this method depends on the transform of the patch.
Isolated patches do not have a transform. In this case, the patch
creation coordinates and the point coordinates match. The following
example checks that the center of a circle is within the circle
>>> center = 0, 0
>>> c = Circle(center, radius=1)
>>> c.contains_point(center)
True
The convention of checking against the transformed patch stems from
the fact that this method is predominantly used to check if display
coordinates (e.g. from mouse events) are within the patch. If you want
to do the above check with data coordinates, you have to properly
transform them first:
>>> center = 0, 0
>>> c = Circle(center, radius=1)
>>> plt.gca().add_patch(c)
>>> transformed_center = c.get_transform().transform(center)
>>> c.contains_point(transformed_center)
True
- contains_points(self, points, radius=None)
- Return whether the given points are inside the patch.
Parameters
----------
points : (N, 2) array
The points to check, in target coordinates of
``self.get_transform()``. These are display coordinates for patches
that are added to a figure or axes. Columns contain x and y values.
radius : float, optional
Additional margin on the patch in target coordinates of
``self.get_transform()``. See `.Path.contains_point` for further
details.
Returns
-------
length-N bool array
Notes
-----
The proper use of this method depends on the transform of the patch.
See the notes on `.Patch.contains_point`.
- get_aa(self)
- Alias for `get_antialiased`.
- get_antialiased(self)
- Return whether antialiasing is used for drawing.
- get_capstyle(self)
- Return the capstyle.
- get_data_transform(self)
- Return the `~.transforms.Transform` mapping data coordinates to
physical coordinates.
- get_ec(self)
- Alias for `get_edgecolor`.
- get_edgecolor(self)
- Return the edge color.
- get_extents(self)
- Return the `Patch`'s axis-aligned extents as a `~.transforms.Bbox`.
- get_facecolor(self)
- Return the face color.
- get_fc(self)
- Alias for `get_facecolor`.
- get_fill(self)
- Return whether the patch is filled.
- get_hatch(self)
- Return the hatching pattern.
- get_joinstyle(self)
- Return the joinstyle.
- get_linestyle(self)
- Return the linestyle.
- get_linewidth(self)
- Return the line width in points.
- get_ls(self)
- Alias for `get_linestyle`.
- get_lw(self)
- Alias for `get_linewidth`.
- get_patch_transform(self)
- Return the `~.transforms.Transform` instance mapping patch coordinates
to data coordinates.
For example, one may define a patch of a circle which represents a
radius of 5 by providing coordinates for a unit circle, and a
transform which scales the coordinates (the patch coordinate) by 5.
- get_transform(self)
- Return the `~.transforms.Transform` applied to the `Patch`.
- get_verts(self)
- Return a copy of the vertices used in this patch.
If the patch contains Bézier curves, the curves will be interpolated by
line segments. To access the curves as curves, use `get_path`.
- get_window_extent(self, renderer=None)
- Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box
"tight" calculation. Default is to return an empty bounding
box at 0, 0.
Be careful when using this function, the results will not update
if the artist window extent of the artist changes. The extent
can change due to any changes in the transform stack, such as
changing the axes limits, the figure size, or the canvas used
(as is done when saving a figure). This can lead to unexpected
behavior where interactive figures will look fine on the screen,
but will save incorrectly.
- set_aa(self, aa)
- Alias for `set_antialiased`.
- set_alpha(self, alpha)
- Set the alpha value used for blending - not supported on all backends.
Parameters
----------
alpha : scalar or None
*alpha* must be within the 0-1 range, inclusive.
- set_antialiased(self, aa)
- Set whether to use antialiased rendering.
Parameters
----------
aa : bool or None
- set_capstyle(self, s)
- Set the `.CapStyle`.
The default capstyle is 'round' for `.FancyArrowPatch` and 'butt' for
all other patches.
Parameters
----------
s : `.CapStyle` or {'butt', 'projecting', 'round'}
- set_color(self, c)
- Set both the edgecolor and the facecolor.
Parameters
----------
c : color
See Also
--------
Patch.set_facecolor, Patch.set_edgecolor
For setting the edge or face color individually.
- set_ec(self, color)
- Alias for `set_edgecolor`.
- set_edgecolor(self, color)
- Set the patch edge color.
Parameters
----------
color : color or None
- set_facecolor(self, color)
- Set the patch face color.
Parameters
----------
color : color or None
- set_fc(self, color)
- Alias for `set_facecolor`.
- set_fill(self, b)
- Set whether to fill the patch.
Parameters
----------
b : bool
- set_hatch(self, hatch)
- Set the hatching pattern.
*hatch* can be one of::
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified
hatchings are done. If same letter repeats, it increases the
density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg
backends only.
Parameters
----------
hatch : {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
- set_joinstyle(self, s)
- Set the `.JoinStyle`.
The default joinstyle is 'round' for `.FancyArrowPatch` and 'miter' for
all other patches.
Parameters
----------
s : `.JoinStyle` or {'miter', 'round', 'bevel'}
- set_linestyle(self, ls)
- Set the patch linestyle.
========================================== =================
linestyle description
========================================== =================
``'-'`` or ``'solid'`` solid line
``'--'`` or ``'dashed'`` dashed line
``'-.'`` or ``'dashdot'`` dash-dotted line
``':'`` or ``'dotted'`` dotted line
``'none'``, ``'None'``, ``' '``, or ``''`` draw nothing
========================================== =================
Alternatively a dash tuple of the following form can be provided::
(offset, onoffseq)
where ``onoffseq`` is an even length tuple of on and off ink in points.
Parameters
----------
ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
The line style.
- set_linewidth(self, w)
- Set the patch linewidth in points.
Parameters
----------
w : float or None
- set_ls(self, ls)
- Alias for `set_linestyle`.
- set_lw(self, w)
- Alias for `set_linewidth`.
- update_from(self, other)
- Copy properties from *other* to *self*.
Data descriptors inherited from matplotlib.patches.Patch:
- fill
- Return whether the patch is filled.
Data and other attributes inherited from matplotlib.patches.Patch:
- zorder = 1
Methods inherited from matplotlib.artist.Artist:
- __getstate__(self)
- add_callback(self, func)
- Add a callback function that will be called whenever one of the
`.Artist`'s properties changes.
Parameters
----------
func : callable
The callback function. It must have the signature::
def func(artist: Artist) -> Any
where *artist* is the calling `.Artist`. Return values may exist
but are ignored.
Returns
-------
int
The observer id associated with the callback. This id can be
used for removing the callback with `.remove_callback` later.
See Also
--------
remove_callback
- convert_xunits(self, x)
- Convert *x* using the unit type of the xaxis.
If the artist is not contained in an Axes or if the xaxis does not
have units, *x* itself is returned.
- convert_yunits(self, y)
- Convert *y* using the unit type of the yaxis.
If the artist is not contained in an Axes or if the yaxis does not
have units, *y* itself is returned.
- findobj(self, match=None, include_self=True)
- Find artist objects.
Recursively find all `.Artist` instances contained in the artist.
Parameters
----------
match
A filter criterion for the matches. This can be
- *None*: Return all objects contained in artist.
- A function with signature ``def match(artist: Artist) -> bool``.
The result will only contain artists for which the function
returns *True*.
- A class instance: e.g., `.Line2D`. The result will only contain
artists of this class or its subclasses (``isinstance`` check).
include_self : bool
Include *self* in the list to be checked for a match.
Returns
-------
list of `.Artist`
- format_cursor_data(self, data)
- Return a string representation of *data*.
.. note::
This method is intended to be overridden by artist subclasses.
As an end-user of Matplotlib you will most likely not call this
method yourself.
The default implementation converts ints and floats and arrays of ints
and floats into a comma-separated string enclosed in square brackets,
unless the artist has an associated colorbar, in which case scalar
values are formatted using the colorbar's formatter.
See Also
--------
get_cursor_data
- get_agg_filter(self)
- Return filter function to be used for agg filter.
- get_alpha(self)
- Return the alpha value used for blending - not supported on all
backends.
- get_animated(self)
- Return whether the artist is animated.
- get_children(self)
- Return a list of the child `.Artist`\s of this `.Artist`.
- get_clip_box(self)
- Return the clipbox.
- get_clip_on(self)
- Return whether the artist uses clipping.
- get_clip_path(self)
- Return the clip path.
- get_cursor_data(self, event)
- Return the cursor data for a given event.
.. note::
This method is intended to be overridden by artist subclasses.
As an end-user of Matplotlib you will most likely not call this
method yourself.
Cursor data can be used by Artists to provide additional context
information for a given event. The default implementation just returns
*None*.
Subclasses can override the method and return arbitrary data. However,
when doing so, they must ensure that `.format_cursor_data` can convert
the data to a string representation.
The only current use case is displaying the z-value of an `.AxesImage`
in the status bar of a plot window, while moving the mouse.
Parameters
----------
event : `~matplotlib.backend_bases.MouseEvent`
See Also
--------
format_cursor_data
- get_figure(self)
- Return the `.Figure` instance the artist belongs to.
- get_gid(self)
- Return the group id.
- get_in_layout(self)
- Return boolean flag, ``True`` if artist is included in layout
calculations.
E.g. :doc:`/tutorials/intermediate/constrainedlayout_guide`,
`.Figure.tight_layout()`, and
``fig.savefig(fname, bbox_inches='tight')``.
- get_label(self)
- Return the label used for this artist in the legend.
- get_mouseover(self)
- Return whether this artist is queried for custom context information
when the mouse cursor moves over it.
- get_path_effects(self)
- get_picker(self)
- Return the picking behavior of the artist.
The possible values are described in `.set_picker`.
See Also
--------
set_picker, pickable, pick
- get_rasterized(self)
- Return whether the artist is to be rasterized.
- get_sketch_params(self)
- Return the sketch parameters for the artist.
Returns
-------
tuple or None
A 3-tuple with the following elements:
- *scale*: The amplitude of the wiggle perpendicular to the
source line.
- *length*: The length of the wiggle along the line.
- *randomness*: The scale factor by which the length is
shrunken or expanded.
Returns *None* if no sketch parameters were set.
- get_snap(self)
- Return the snap setting.
See `.set_snap` for details.
- get_tightbbox(self, renderer=None)
- Like `.Artist.get_window_extent`, but includes any clipping.
Parameters
----------
renderer : `.RendererBase` subclass
renderer that will be used to draw the figures (i.e.
``fig.canvas.get_renderer()``)
Returns
-------
`.Bbox`
The enclosing bounding box (in figure pixel coordinates).
- get_transformed_clip_path_and_affine(self)
- Return the clip path with the non-affine part of its
transformation applied, and the remaining affine part of its
transformation.
- get_url(self)
- Return the url.
- get_visible(self)
- Return the visibility.
- get_zorder(self)
- Return the artist's zorder.
- have_units(self)
- Return whether units are set on any axis.
- is_transform_set(self)
- Return whether the Artist has an explicitly set transform.
This is *True* after `.set_transform` has been called.
- pchanged(self)
- Call all of the registered callbacks.
This function is triggered internally when a property is changed.
See Also
--------
add_callback
remove_callback
- pick(self, mouseevent)
- Process a pick event.
Each child artist will fire a pick event if *mouseevent* is over
the artist and the artist has picker set.
See Also
--------
set_picker, get_picker, pickable
- pickable(self)
- Return whether the artist is pickable.
See Also
--------
set_picker, get_picker, pick
- properties(self)
- Return a dictionary of all the properties of the artist.
- remove(self)
- Remove the artist from the figure if possible.
The effect will not be visible until the figure is redrawn, e.g.,
with `.FigureCanvasBase.draw_idle`. Call `~.axes.Axes.relim` to
update the axes limits if desired.
Note: `~.axes.Axes.relim` will not see collections even if the
collection was added to the axes with *autolim* = True.
Note: there is no support for removing the artist's legend entry.
- remove_callback(self, oid)
- Remove a callback based on its observer id.
See Also
--------
add_callback
- set_agg_filter(self, filter_func)
- Set the agg filter.
Parameters
----------
filter_func : callable
A filter function, which takes a (m, n, depth) float array
and a dpi value, and returns a (m, n, depth) array and two
offsets from the bottom left corner of the image
.. ACCEPTS: a filter function, which takes a (m, n, 3) float array
and a dpi value, and returns a (m, n, 3) array and two offsets
from the bottom left corner of the image
- set_animated(self, b)
- Set whether the artist is intended to be used in an animation.
If True, the artist is excluded from regular drawing of the figure.
You have to call `.Figure.draw_artist` / `.Axes.draw_artist`
explicitly on the artist. This approach is used to speed up animations
using blitting.
See also `matplotlib.animation` and
:doc:`/tutorials/advanced/blitting`.
Parameters
----------
b : bool
- set_clip_box(self, clipbox)
- Set the artist's clip `.Bbox`.
Parameters
----------
clipbox : `.Bbox`
Typically would be created from a `.TransformedBbox`. For
instance ``TransformedBbox(Bbox([[0, 0], [1, 1]]), ax.transAxes)``
is the default clipping for an artist added to an Axes.
- set_clip_on(self, b)
- Set whether the artist uses clipping.
When False, artists will be visible outside the Axes which
can lead to unexpected results.
Parameters
----------
b : bool
- set_clip_path(self, path, transform=None)
- Set the artist's clip path.
Parameters
----------
path : `~matplotlib.patches.Patch` or `.Path` or `.TransformedPath` or None
The clip path. If given a `.Path`, *transform* must be provided as
well. If *None*, a previously set clip path is removed.
transform : `~matplotlib.transforms.Transform`, optional
Only used if *path* is a `.Path`, in which case the given `.Path`
is converted to a `.TransformedPath` using *transform*.
Notes
-----
For efficiency, if *path* is a `.Rectangle` this method will set the
clipping box to the corresponding rectangle and set the clipping path
to ``None``.
For technical reasons (support of `~.Artist.set`), a tuple
(*path*, *transform*) is also accepted as a single positional
parameter.
.. ACCEPTS: Patch or (Path, Transform) or None
- set_figure(self, fig)
- Set the `.Figure` instance the artist belongs to.
Parameters
----------
fig : `.Figure`
- set_gid(self, gid)
- Set the (group) id for the artist.
Parameters
----------
gid : str
- set_in_layout(self, in_layout)
- Set if artist is to be included in layout calculations,
E.g. :doc:`/tutorials/intermediate/constrainedlayout_guide`,
`.Figure.tight_layout()`, and
``fig.savefig(fname, bbox_inches='tight')``.
Parameters
----------
in_layout : bool
- set_label(self, s)
- Set a label that will be displayed in the legend.
Parameters
----------
s : object
*s* will be converted to a string by calling `str`.
- set_mouseover(self, mouseover)
- Set whether this artist is queried for custom context information when
the mouse cursor moves over it.
Parameters
----------
mouseover : bool
See Also
--------
get_cursor_data
.ToolCursorPosition
.NavigationToolbar2
- set_path_effects(self, path_effects)
- Set the path effects.
Parameters
----------
path_effects : `.AbstractPathEffect`
- set_picker(self, picker)
- Define the picking behavior of the artist.
Parameters
----------
picker : None or bool or float or callable
This can be one of the following:
- *None*: Picking is disabled for this artist (default).
- A boolean: If *True* then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
- A float: If picker is a number it is interpreted as an
epsilon tolerance in points and the artist will fire
off an event if its data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, e.g., the indices of the data within
epsilon of the pick event
- A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event::
hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the
artist, return *hit=True* and props is a dictionary of
properties you want added to the PickEvent attributes.
- set_rasterized(self, rasterized)
- Force rasterized (bitmap) drawing for vector graphics output.
Rasterized drawing is not supported by all artists. If you try to
enable this on an artist that does not support it, the command has no
effect and a warning will be issued.
This setting is ignored for pixel-based output.
See also :doc:`/gallery/misc/rasterization_demo`.
Parameters
----------
rasterized : bool
- set_sketch_params(self, scale=None, length=None, randomness=None)
- Set the sketch parameters.
Parameters
----------
scale : float, optional
The amplitude of the wiggle perpendicular to the source
line, in pixels. If scale is `None`, or not provided, no
sketch filter will be provided.
length : float, optional
The length of the wiggle along the line, in pixels
(default 128.0)
randomness : float, optional
The scale factor by which the length is shrunken or
expanded (default 16.0)
The PGF backend uses this argument as an RNG seed and not as
described above. Using the same seed yields the same random shape.
.. ACCEPTS: (scale: float, length: float, randomness: float)
- set_snap(self, snap)
- Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in
clearer images. For example, if a black line of 1px width was
defined at a position in between two pixels, the resulting image
would contain the interpolated value of that line in the pixel grid,
which would be a grey value on both adjacent pixel positions. In
contrast, snapping will move the line to the nearest integer pixel
value, so that the resulting image will really contain a 1px wide
black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Parameters
----------
snap : bool or None
Possible values:
- *True*: Snap vertices to the nearest pixel center.
- *False*: Do not modify vertex positions.
- *None*: (auto) If the path contains only rectilinear line
segments, round to the nearest pixel center.
- set_transform(self, t)
- Set the artist transform.
Parameters
----------
t : `.Transform`
- set_url(self, url)
- Set the url for the artist.
Parameters
----------
url : str
- set_visible(self, b)
- Set the artist's visibility.
Parameters
----------
b : bool
- set_zorder(self, level)
- Set the zorder for the artist. Artists with lower zorder
values are drawn first.
Parameters
----------
level : float
- update(self, props)
- Update this artist's properties from the dict *props*.
Parameters
----------
props : dict
Class methods inherited from matplotlib.artist.Artist:
- __init_subclass__() from builtins.type
- This method is called when a class is subclassed.
The default implementation does nothing. It may be
overridden to extend subclasses.
Readonly properties inherited from matplotlib.artist.Artist:
- sticky_edges
- ``x`` and ``y`` sticky edge lists for autoscaling.
When performing autoscaling, if a data limit coincides with a value in
the corresponding sticky_edges list, then no margin will be added--the
view limit "sticks" to the edge. A typical use case is histograms,
where one usually expects no margin on the bottom edge (0) of the
histogram.
Moreover, margin expansion "bumps" against sticky edges and cannot
cross them. For example, if the upper data limit is 1.0, the upper
view limit computed by simple margin application is 1.2, but there is a
sticky edge at 1.1, then the actual upper view limit will be 1.1.
This attribute cannot be assigned to; however, the ``x`` and ``y``
lists can be modified in place as needed.
Examples
--------
>>> artist.sticky_edges.x[:] = (xmin, xmax)
>>> artist.sticky_edges.y[:] = (ymin, ymax)
Data descriptors inherited from matplotlib.artist.Artist:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- axes
- The `~.axes.Axes` instance the artist resides in, or *None*.
- mouseover
- Return whether this artist is queried for custom context information
when the mouse cursor moves over it.
- stale
- Whether the artist is 'stale' and needs to be re-drawn for the output
to match the internal state of the artist.
| |