-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Legend does not show 'annotate' #8236
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
Comments
Because they are not in the list of things the that are looked for to be added to the legend by default. Start from https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L546 and trace back. You will probably also have to add a LegendHandler. Exact work:
@jlecoeur want to take a crack at this? |
Tagged as new contributor friendly because it is self-contained, but medium difficulty as it involves understanding the legend machinery (which is powerful, but a bit under-documented). |
@jlecoeur: You can achieve something close to what you are looking for with:
It would be better if legend found the annotation arrow automatically. It would also be better if legend handled FancyArrowPatches better. They are all drawn as rectangles, which is the default for patches, but they should draw little arrows in the legend. I'm new to this, so here are my thoughts on how to proceed:
|
Thanks @bendichter @tacaswell, I will try to implement it and I'll let you know! |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
When using
annotate
to draw an arrow, it does not show up in the legend.Example code:
gives:

I would expect an entry "distance" in the legend, with a grey double-sided arrow as symbol.
(I use Python 3.6.0 and Matplotlib 2.0.0 from Archlinux repository)
The text was updated successfully, but these errors were encountered: