Bases: matplotlib.patches.Patch
A fancy arrow patch. It draws an arrow using the ArrowStyle
.
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:
(x, y) coordinates of arrow tail and arrow head respectively.
Path
, default: None
If provided, an arrow is drawn along this path and patchA, patchB, shrinkA, and shrinkB are ignored.
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 |
| head_length=0.5, head_width=0.5, tail_width=0.2 |
Fancy |
| head_length=0.4, head_width=0.4, tail_width=0.4 |
Wedge |
| tail_width=0.3, shrink_factor=0.5 |
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 |
| rad=0.0 |
Angle3 |
| angleA=90, angleB=0 |
Angle |
| angleA=90, angleB=0, rad=0.0 |
Arc |
| angleA=0, angleB=0, armA=None, armB=None, rad=0.0 |
Bar |
| armA=0.0, armB=0.0, fraction=0.3, angle=None |
Patch
, default: None
Head and tail patches, respectively.
Shrinking factor of the tail and head of the arrow respectively.
Value with which attributes of arrowstyle (e.g., head_length) will be scaled.
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.
dpi_cor is currently used for linewidth-related things and shrink factor. Mutation scale is affected by this. Deprecated.
Patch
properties, optional
Here is a list of available Patch
properties:
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
unknown | |
bool | |
| bool or None |
| |
bool | |
Patch or (Path, Transform) or None | |
color | |
| color or None |
| color or None |
bool | |
str | |
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} | |
bool | |
| |
object | |
| {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
| float or None |
None or bool or float or callable | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
str | |
bool | |
float |
In contrast to other patches, the default capstyle
and joinstyle
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_visible
returns False).
RendererBase
subclass.
This method is overridden in the Artist subclasses.
Return the arrowstyle object.
Return the ConnectionStyle
used.
[Deprecated] dpi_cor is currently used for linewidth-related things and shrink factor. Mutation scale is affected by this.
Deprecated since version 3.4.
Return the aspect ratio of the bbox mutation.
Return the mutation scale.
Return the path of the arrow in the data coordinates.
Set multiple properties at once.
Supported properties are
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
scalar or None | |
bool | |
| bool or None |
None or ArrowStyle or str, default: None | |
| |
bool | |
Patch or (Path, Transform) or None | |
color | |
str or | |
unknown | |
| color or None |
| color or None |
bool | |
str | |
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} | |
bool | |
| |
object | |
| {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
| float or None |
float | |
float | |
None or bool or float or callable | |
unknown | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
str | |
bool | |
float |
Set the arrow style. Old attributes are forgotten. Without arguments (or with arrowstyle=None
) returns available box styles as a list of strings.
Can be a string with arrowstyle name with optional comma-separated attributes, e.g.:
set_arrowstyle("Fancy,head_length=0.2")
Alternatively attributes can be provided as keywords, e.g.:
set_arrowstyle("fancy", head_length=0.2)
Set the connection style. Old attributes are forgotten.
ConnectionStyle
or None, optional
Can be a string with connectionstyle name with optional comma-separated attributes, e.g.:
set_connectionstyle("arc,angleA=0,armA=30,rad=10")
Alternatively, the attributes can be provided as keywords, e.g.:
set_connectionstyle("arc", angleA=0,armA=30,rad=10)
Without any arguments (or with connectionstyle=None
), return available styles as a list of strings.
[Deprecated] dpi_cor is currently used for linewidth-related things and shrink factor. Mutation scale is affected by this.
Deprecated since version 3.4.
Set the aspect ratio of the bbox mutation.
Set the mutation scale.
Set the tail patch.
patches.Patch
Set the head patch.
patches.Patch
matplotlib.patches.FancyArrowPatch
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.patches.FancyArrowPatch.html