Skip to content

[ENH]: Add fancyarrow() as a function to draw single arrows #29826

@timhoffm

Description

@timhoffm

Problem

Drawing arrows is currently a mess.

  1. We have ax.arrow() which uses a fundamentally broken transformation, typically resulting in skewed arrows.
  2. There has been ample discussion on replacing arrow() with a more general vector() method Vector #22435
  3. We have the recommendation to ax.annotate() with an empty text.

I feel (3.) is quite complicated if you just want to draw an arrow between two points. I therefore suggest to add a method ax.fancyarrow() to replace (3.). It's basically a wrapper for creating a FancyArrowPatch

def fancyarrow(self, ...):
    patch = FancyArrowPatch(...)
    self.add_patch(patch)
    return patch

Rationale:

  • The FancyArrowPatch API is capable and clear.
  • a wrapper function is justified since user code typically does not explicitly create and add Artists
  • The scope is reasonably different from what is discussed for vector() so that it does not overlap with a potential introduction of vector() later
  • the name fancyarrow is a bit ... fancy, but we cannot use arrow and since this returns a FancyArrowPatch, fancyarrow seems the best viable name.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions