-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Process clip paths the same way as regular Paths. #15970
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
Specifically, run NaN removal, clipping to figure boundary, snapping to pixel centers, and path simplification on it. This means if you plot a Path, and then clip some other artist with it, you will get properly aligned results.
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.
Seems straightforward enough, though I'm by no means an expert on the Agg code...
mplcairo does the same (but that was really an accidental, though welcome, side effect of having a single python-path -> c++ path loader). |
@QuLogic milestone this to whatever sounds good to you and merge yourself? |
Well, my preference is as far back as possible for Cartopy's sake, of course, but it's difficult to assess the effect since so little of the library uses clip paths itself. |
I think this can quite reasonably be called a bug fix. And having it in 3.2 would make it easier to get something into the next CartoPy release... |
Getting 3.2 rc3 tagged, published and publicized is on my to-do for this weekend. |
…970-on-v3.2.x Backport PR #15970 on branch v3.2.x (Process clip paths the same way as regular Paths.)
This is the only test that is affected by matplotlib/matplotlib#15970. The new image is correct, but the difference is small enough to just change the tolerance.
This is the only test that is affected by matplotlib/matplotlib#15970. The new image is correct, but the difference is small enough to just change the tolerance.
This is the only test that is affected by matplotlib/matplotlib#15970. The new image is correct, but the difference is small enough to just change the tolerance.
This is the only test that is affected by matplotlib/matplotlib#15970. The new image is correct, but the difference is small enough to just change the tolerance.
PR Summary
Specifically, run NaN removal, clipping to figure boundary, snapping to pixel centers, and path simplification on it.
This means if you plot a Path, and then clip some other artist with it, you will get properly aligned results.
I'm not entirely sure whether it makes sense to run NaN removal and figure clipping on the clip path, but I put them in for consistency with other paths. There don't seem to be any tests that are affected by these two. The change to
lib/matplotlib/tests/baseline_images/test_offsetbox/offsetbox_clipping.png
is because the clip path is snapped and better aligns with the other path. The change tolib/matplotlib/tests/baseline_images/test_axes/imshow_clip.png
is a minor effect of path simplification on the clip path.Fixes #15952. It also fixes the problem in Cartopy (see SciTools/cartopy#1422) for some cases, but not all. I'll need to investigate that a bit further.
PR Checklist