Bases: matplotlib.patches.FancyArrowPatch
A patch that connects two points (possibly in different axes).
Connect point xyA in coordsA with point xyB in coordsB.
Valid keys are
Key | Description |
---|---|
arrowstyle | the arrow style |
connectionstyle | the connection style |
relpos | default is (0.5, 0.5) |
patchA | default is bounding box of the text |
patchB | default is None |
shrinkA | default is 2 points |
shrinkB | default is 2 points |
mutation_scale | default is text size (in points) |
mutation_aspect | default is 1. |
? | any key for |
coordsA and coordsB are strings that indicate the coordinates of xyA and xyB.
Property | Description |
---|---|
'figure points' | points from the lower left corner of the figure |
'figure pixels' | pixels from the lower left corner of the figure |
'figure fraction' | 0, 0 is lower left of figure and 1, 1 is upper right |
'subfigure points' | points from the lower left corner of the subfigure |
'subfigure pixels' | pixels from the lower left corner of the subfigure |
'subfigure fraction' | fraction of the subfigure, 0, 0 is lower left. |
'axes points' | points from lower left corner of axes |
'axes pixels' | pixels from lower left corner of axes |
'axes fraction' | 0, 0 is lower left of axes and 1, 1 is upper right |
'data' | use the coordinate system of the object being annotated (default) |
'offset points' | offset (in points) from the xy value |
'polar' | you can specify theta, r for the annotation, even in cartesian plots. Note that if you are using a polar axes, you do not need to specify polar for the coordinate system since that is the native "data" coordinate system. |
Alternatively they can be set to any valid Transform
.
Note that 'subfigure pixels' and 'figure pixels' are the same for the parent figure, so users who want code that is usable in a subfigure can use 'subfigure pixels'.
Note
Using ConnectionPatch
across two Axes
instances is not directly compatible with constrained layout. Add the artist directly to the Figure
instead of adding it to a specific Axes, or exclude it from the layout using con.set_in_layout(False)
.
fig, ax = plt.subplots(1, 2, constrained_layout=True) con = ConnectionPatch(..., axesA=ax[0], axesB=ax[1]) fig.add_artist(con)
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 clipping behavior.
See set_annotation_clip
for the meaning of the return value.
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 | |
| 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 clipping behavior.
self.xy
is inside the axes.self.xy
is inside the axes and self.xycoords == "data"
.matplotlib.patches.ConnectionPatch
© 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.ConnectionPatch.html