Bases: Patch
A fancy arrow patch.
It draws an arrow using the ArrowStyle
. It is primarily used by the annotate
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.
Defining the arrow position and path
There are two ways to define the arrow position and path:
Start, end and connection: The typical approach is to define the start and end points of the arrow using posA and posB. The curve between these two can further be configured using connectionstyle.
If given, the arrow curve is clipped by patchA and patchB, allowing it to start/end at the border of these patches. Additionally, the arrow curve can be shortened by shrinkA and shrinkB to create a margin between start/end (after possible clipping) and the drawn arrow.
path: Alternatively if path is provided, an arrow is drawn along this Path. In this case, connectionstyle, patchA, patchB, shrinkA, and shrinkB are ignored.
Styling
The arrowstyle defines the styling of the arrow head, tail and shaft. The resulting arrows can be styled further by setting the Patch
properties such as linewidth, color, facecolor, edgecolor etc. via keyword arguments.
(x, y) coordinates of start and end point of the arrow. The actually drawn start and end positions may be modified through patchA, patchB, shrinkA, and shrinkB.
posA, posB are exclusive of path.
Path
, optional
If provided, an arrow is drawn along this path and patchA, patchB, shrinkA, and shrinkB are ignored.
path is exclusive of posA, posB.
ArrowStyle
, default: 'simple'
The styling of arrow head, tail and shaft. This can be
ArrowStyle
or one of its subclasses
The shorthand string name (e.g. "->") as given in the table below, optionally containing a comma-separated list of style parameters, e.g. "->, head_length=10, head_width=5".
The style parameters are scaled by mutation_scale.
The following arrow styles are available. See also Annotation arrow style reference.
Only the styles <|-
, -|>
, <|-|>
simple
, fancy
and wedge
contain closed paths and can be filled.
ConnectionStyle
or None, optional, default: 'arc3'
ConnectionStyle
with which posA and posB are connected. This can be
ConnectionStyle
or one of its subclasses
The shorthand string name as given in the table below, e.g. "arc3".
Ignored if path is provided.
Patch
, default: None
Optional Patches at posA and posB, respectively. If given, the arrow path is clipped by these patches such that head and tail are at the border of the patches.
Ignored if path is provided.
Shorten the arrow path at posA and posB by this amount in points. This allows to add a margin between the intended start/end points and the arrow.
Ignored if path is provided.
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.
Patch
properties, optional
Here is a list of available Patch
properties:
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.
Notes
This method is overridden in the Artist subclasses.
Return the arrowstyle object.
Return the ConnectionStyle
used.
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
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.
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:
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 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.
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:
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 the aspect ratio of the bbox mutation.
Set the mutation scale.
Set the tail patch.
patches.Patch
Set the head patch.
patches.Patch
Set the start and end positions of the connecting path.
(x, y) coordinates of arrow tail and arrow head respectively. If None
use current value.
matplotlib.patches.FancyArrowPatch
#
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4