matplotlib.patches.ConnectionPatch — Matplotlib 3.10.1 documentation (original) (raw)

class matplotlib.patches.ConnectionPatch(xyA, xyB, coordsA, coordsB=None, *, axesA=None, axesB=None, arrowstyle='-', connectionstyle='arc3', patchA=None, patchB=None, shrinkA=0.0, shrinkB=0.0, mutation_scale=10.0, mutation_aspect=None, clip_on=False, **kwargs)[source]#

Bases: FancyArrowPatch

A patch that connects two points (possibly in different Axes).

Connect point xyA in coordsA with point xyB in coordsB.

Valid keys are

coordsA and coordsB are strings that indicate the coordinates of xyA and xyB.

Alternatively they can be set to any validTransform.

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(renderer)[source]#

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.

get_annotation_clip()[source]#

Return the clipping behavior.

See set_annotation_clip for the meaning of the return value.

set(*, agg_filter=, alpha=, animated=, annotation_clip=, 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_annotation_clip(b)[source]#

Set the annotation's clipping behavior.

Parameters:

bbool or None

Examples using matplotlib.patches.ConnectionPatch#