matplotlib 3.5.1

__init__(self, 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, dpi_cor=<deprecated parameter>, **kwargs)

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 matplotlib.patches.PathPatch =============== ======================================================

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 ~matplotlib.transforms.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 :None:None:`ConnectionPatch` across two :None:None:`~.axes.Axes` instances is not directly compatible with :None:doc:`constrained layout </tutorials/intermediate/constrainedlayout_guide>`. Add the artist directly to the :None:None:`.Figure` instead of adding it to a specific Axes, or exclude it from the layout using con.set_in_layout(False) .

.. code-block:: default
    fig, ax = plt.subplots(1, 2, constrained_layout=True)
    con = ConnectionPatch(..., axesA=ax[0], axesB=ax[1])
    fig.add_artist(con)

Connect point xyA in coordsA with point xyB in coordsB.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/patches.py#4506
type: <class 'function'>
Commit: