-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Shadow patch now initializes zorder behind argument patch #9435
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
Shadow patch now initializes zorder behind argument patch #9435
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.
Can you write an image test for the correct behaviour? Maybe make sense to merge this and #9426 so the test works? I think the test makes sense in `matplotlib/lib/tests/test_patches.py
@jklymak Is an image test really necessary (I think that we are currently trying to avoid as much as possible these kinds of test, that are bloating a bit the git historic)? Couldn't one simply test that after init the z-order of the |
@afvincent I guess I was also worried about the transform issue in #9426 but maybe both can be finessed without an actual image test? But sure, just checking that the zorders are ordered properly is great! |
I think that the best way is (as mentioned in a few other places) to have an "as if" test: generate figure 1 with the shadow created before the rectangle is added (the previously failing case) and figure 2 with two manually positioned rectangles with the correct zorder and correct positions. It's a bit tricky to write though and I'm fine with taking care of it in #9426 (after this PR gets merged). |
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.
OK, then I approve this if a test is put into #9426....
Thanks a lot @clintval! |
PR Summary
When initializing a
patch.Shadow
instance the object inherits the same zorder as the passed patch. This behavior draws the two patches in the same plane. This PR initializes thepatch.Shadow
to take the next smallerzorder
by default.This fixes an issue about zorder stacking for Shadow patches referenced here: #9377
PR Checklist