Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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 uson gitter for real-time discussion.
For details on testing, writing docs, and our review process, please seethe developer guide
We strive to be a welcoming and open project. Please follow ourCode of Conduct.
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? |
Please see theinstructions in our contribution guide. |
alextanned commentedDec 9, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hello, could you please provide some guidance on the failed tests? How should I address thePR 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 aninteractive rebase. I strongly recommend saving a backup copy of your branch first if you have not done this (much) before. |
685e6f1
to474bf00
CompareUh oh!
There was an error while loading.Please reload this page.
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. |
This looks good to go - it just needs rebasing on to the current |
Co-authored-by: alextanned <74106760+alextanned@users.noreply.github.com>
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