-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fix bug where make_compound_path kept all STOPs #16822
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
lib/matplotlib/path.py
Outdated
@@ -341,6 +342,16 @@ def make_compound_path(cls, *args): | |||
codes[i:i + len(path.codes)] = path.codes | |||
i += len(path.vertices) | |||
|
|||
# remove internal STOP's, replace kinal stop if present |
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.
typo: final
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 also not bother with restoring the final STOP given that it doesn't matter and we may deprecate STOPs.
And even though this is clearly a bugfix, it also changes the behavior of the function wrt STOP codes, so it may change it a tiny bit more (in a less observable fashion! the final STOP doesn't matter, unlike the middle ones) to keep the implementation simpler.
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.
If that is acceptable, then I will document it and go with ignoring all STOPs.
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.
at least for me, it seems ok.
I am concerned about deprecating a path code given how far down the stack this is. Would it be simpler to replace the STOP with MOVETO in the concatenated codes? |
Notionally 👍 to this change, concerned about deprecating STOP, holding off on approving given there are 3 proposed implementations ;) |
this is still not deprecating STOP, just changing the behavior of make_compound_path. |
I will also point out here for the record that the "truly correct" behavior is something like
but making this solution actually work adds a disproportionate amount of code complexity for a corner case (concatenating multiple paths with internal STOPs) that it's not clear we need to support (whereas concatenating a bunch of paths that correctly end in stop should surely work correctly). |
aecfef3
to
2f72135
Compare
2f72135
to
95b33b1
Compare
Sorry for force-push. Accidentally pull'd in from master, had to rebase to trigger CI to finish running. |
Force-pushing to your own PR branch is perfectly fine. |
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.
anyone can merge postci.
Thanks @brunobeltran! |
PR Summary
Fixes underlying issue in
make_compound_path
that would keep.Path.cleaned
from being a drop-in replacement forbezier.make_path_regular
(#14199).A path we create by concatenating many paths should never have internal STOPs, as STOP is documented to mark the end of the entire path.
Long term solution is probably to deprecate
Path.STOP
, but then this code can be easily deleted as it is self-contained, and the new test will signal.PR Checklist