matplotlib.patches.FancyArrowPatch — Matplotlib 3.10.1 documentation (original) (raw)
class matplotlib.patches.FancyArrowPatch(posA=None, posB=None, *, path=None, arrowstyle='simple', connectionstyle='arc3', patchA=None, patchB=None, shrinkA=2, shrinkB=2, mutation_scale=1, mutation_aspect=1, **kwargs)[source]#
Bases: Patch
A fancy arrow patch.
It draws an arrow using the ArrowStyle. It is primarily used by theannotate method. For most purposes, use the annotate method for drawing arrows.
The head and tail positions are fixed at the specified start and end points of the arrow, but the size and shape (in display coordinates) of the arrow does not change when the axis is moved or zoomed.
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.
pathPath, default: None
If provided, an arrow is drawn along this path and patchA,patchB, shrinkA, and shrinkB are ignored.
arrowstylestr 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:
connectionstylestr 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:
patchA, patchBPatch, default: None
Head and tail patches, respectively.
shrinkA, shrinkBfloat, default: 2
Shrink amount, in points, of the tail and head of the arrow respectively.
mutation_scalefloat, default: 1
Value with which attributes of arrowstyle (e.g., head_length) will be scaled.
mutation_aspectNone 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:
**kwargsPatch properties, optional
Here is a list of available Patch properties:
In contrast to other patches, the default capstyle
andjoinstyle
for FancyArrowPatch are set to "round"
.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visiblereturns False).
Parameters:
rendererRendererBase subclass.
Notes
This method is overridden in the Artist subclasses.
Return the arrowstyle object.
get_connectionstyle()[source]#
Return the ConnectionStyle used.
get_mutation_aspect()[source]#
Return the aspect ratio of the bbox mutation.
Return the mutation scale.
Returns:
scalar
Return the path of the arrow in the data coordinates.
set(*, agg_filter=, alpha=, animated=, antialiased=, arrowstyle=, capstyle=, clip_box=, clip_on=, clip_path=, color=, connectionstyle=, edgecolor=, facecolor=, fill=, gid=, hatch=, hatch_linewidth=, in_layout=, joinstyle=, label=, linestyle=, linewidth=, mouseover=, mutation_aspect=, mutation_scale=, patchA=, patchB=, path_effects=, picker=, positions=, rasterized=, sketch_params=, snap=, transform=, url=, visible=, zorder=)[source]#
Set multiple properties at once.
Supported properties are
set_arrowstyle(arrowstyle=None, **kwargs)[source]#
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:
arrowstylestr or 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:
**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(connectionstyle=None, **kwargs)[source]#
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:
connectionstylestr or 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:
**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(aspect)[source]#
Set the aspect ratio of the bbox mutation.
Parameters:
aspectfloat
set_mutation_scale(scale)[source]#
Set the mutation scale.
Parameters:
scalefloat
Set the tail patch.
Parameters:
patchApatches.Patch
Set the head patch.
Parameters:
patchBpatches.Patch
set_positions(posA, posB)[source]#
Set the start and end positions of the connecting path.
Parameters:
posA, posBNone, tuple
(x, y) coordinates of arrow tail and arrow head respectively. IfNone use current value.