-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixed legend with legend location "best" when legend overlaps shaded area and text #27469
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
935f98e
to
a19a24c
Compare
lib/matplotlib/legend.py
Outdated
if isinstance(artist, PolyCollection): | ||
paths = artist.get_paths() | ||
for path in paths: | ||
lines.append(artist.get_transform().transform_path(path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably just have this in the if/elif chain rather than inside of one of the cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do believe this should have a behavior change note, while "best" is intentionally 'we take care of it for you' and so I don't necessarily think it can't change, noting when the change occurs is something we should do. |
I agree. How does the newly added note look? |
ce3ab76
to
90d8a75
Compare
Please see the instructions in our contribution guide. |
Hello, could you please provide some guidance on the failed tests? How should I address the PR cleanliness? |
The PR cleanliness failure is because you replaced a test image twice. We don't want any more images in the commit history than necessary, so you will need to squash the commits down. To squash, you can do an interactive rebase. I strongly recommend saving a backup copy of your branch first if you have not done this (much) before. |
685e6f1
to
474bf00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@alanlau28 if you can reduce the number of commits that would be great (rebase and fixup/squash)! If not, we just have to remember to squash while merging.
Yes, we definitely do not want these "Empty-Commit" commits with nothing in them. |
2e37c65
to
b1d8bc7
Compare
This looks good to go - it just needs rebasing on to the current |
Co-authored-by: alextanned <[email protected]>
b1d8bc7
to
87d05ae
Compare
I think it would be good to get this in, so I took the liberty of rebasing and squashing. The conflict was just because an adjacent branch of the if-loop was modified at #27517. |
PR summary
This PR fixes bug #27414 and #23323. The calculation of badness in the legend location for 'best' now considers PolyCollection and Text. For PolyCollection, the paths are now converted to lines to check for hit detection when placing a legend. For Text, the bounding box is now checked for overlap.
PR checklist