Skip to content

[ENH]: expand connectionPatch coords to support all annotation coords #26440

Open

Description

@story645

Problem

ConnectionPatch is described as annotation w/o text in the tutorial and as a function for connecting two aribtrary points in its docs and it would be very helpful if those two points could be artists. Since annotation supports this, I'm doing a lot of

arrow = ax.annotate("", (x1, y1), (x2, y2), xycoords=A1, textcoords=A2, arrowprops=dict(arrowstyle='-|>'))
label = ax.annotate("label", (xp, yp), xycoords=arrow)

and I'd really rather prefer to use the object with "connect thing" semantics for connecting things and the object with "label things" semantics for labeling.

Proposed solution

@anntzer proposed factoring out the annotation coordinate system in #22223 (comment) and that's the approach I'd advocate here -> pull out the coordinate logic into its own logic and then have ConnectionPatch call out to that function.

Activity

  1. dikshajangra12918-oss commented on Apr 14, 2026

    @dikshajangra12918-oss
    Contributor

    Sir,

    I have compared _AnnotationBase._get_xy_transform in text.py with ConnectionPatch._get_xy in patches.py .

    ConnectionPatch._get_xy does not support Artist, BboxBase, Transform, or callable as coordinate types, while Annotation does.

    Would the fix involve refactoring _get_xy_transform into a shared utility function that both Annotation and ConnectionPatch can use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions