Skip to content

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

Merged
merged 1 commit into from
Oct 19, 2017
Merged

Shadow patch now initializes zorder behind argument patch #9435

merged 1 commit into from
Oct 19, 2017

Conversation

clintval
Copy link
Contributor

@clintval clintval commented Oct 16, 2017

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 the patch.Shadow to take the next smaller zorder by default.


This fixes an issue about zorder stacking for Shadow patches referenced here: #9377

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Copy link
Member

@jklymak jklymak left a 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

@afvincent
Copy link
Contributor

@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 Shadow instance indeed smaller than the z-order of the parent patch?

@jklymak
Copy link
Member

jklymak commented Oct 16, 2017

@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!

@anntzer
Copy link
Contributor

anntzer commented Oct 16, 2017

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).

Copy link
Member

@jklymak jklymak left a 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....

@dstansby
Copy link
Member

Thanks a lot @clintval!

@dstansby dstansby added this to the v2.2 milestone Oct 19, 2017
@dstansby dstansby merged commit 9ea08fb into matplotlib:master Oct 19, 2017
@clintval clintval deleted the cv_shadow_patch_zorder_init branch October 19, 2017 09:26
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants