Skip to content

Deprecate Axes.arrow/pyplot.arrow #20387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anntzer opened this issue Jun 8, 2021 · 2 comments
Open

Deprecate Axes.arrow/pyplot.arrow #20387

anntzer opened this issue Jun 8, 2021 · 2 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Jun 8, 2021

Bug report

Bug summary

Axes.arrow/pyplot.arrow generates a FancyArrow, which has a rather awkward API (#12768); we typically suggest to use Axes.annotate/pyplot.annotate instead (even the docstring of arrow() does so!). We may want to keep FancyArrow around for backcompat (it is simple to convert calls to arrow() to ax.add_patch(FancyArrow(<the same args>))), but at least we should consider deprecating the toplevel arrow() function, which is just a bad trap for any new users.

Matplotlib version

  • Operating system:
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.4.x
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:
@Valkje
Copy link

Valkje commented Jan 23, 2025

I'd like to bump this. Just spent quite some time trying to get this to work on a polar plot before I stumbled across the relevant Github issues saying that arrow will not work there. Adding a note/warning to the docs that it probably won't work outside a cartesian coordinate system would already help a lot!
(The current note only talks about Axes aspect ratio and limits, which is not the same thing as a different coordinate system.)

@timhoffm
Copy link
Member

timhoffm commented Jan 24, 2025

There are 17k usage of arrow() in GitHub repos: https://github.com/search?q=ax.arrow&type=code

I think we have to take it slow (and yes we should have started that process 4 years ago).

timhoffm added a commit to timhoffm/matplotlib that referenced this issue Jan 24, 2025
The arrow() design is broken beyond repair. Even though we currently only have to offer `annotate` as a workaround, we should make the limitations more prominent then just a note and we should steer users away.

This is a a step towards deprecation (matplotlib#20387). Unfortunately the discussion of a replacement has stalled (matplotlib#22435) and we have to revive it later. But that shound not hold us from pointing out the flaws
of arrow() more prominently.
timhoffm added a commit to timhoffm/matplotlib that referenced this issue Jan 24, 2025
The arrow() design is broken beyond repair. Even though we currently only have to offer `annotate` as a workaround, we should make the limitations more prominent then just a note and we should steer users away.

This is a a step towards deprecation (matplotlib#20387). Unfortunately the discussion of a replacement has stalled (matplotlib#22435) and we have to revive it later. But that shound not hold us from pointing out the flaws
of arrow() more prominently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants