Skip to content
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

Merged
merged 1 commit into from Oct 19, 2017

Conversation

Projects
None yet
6 participants
@clintval
Copy link
Contributor

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
@jklymak
Copy link
Contributor

left a comment

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

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2017

@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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

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

@jklymak
Copy link
Contributor

left a comment

OK, then I approve this if a test is put into #9426....

@dstansby

This comment has been minimized.

Copy link
Contributor

commented Oct 19, 2017

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

8 checks passed

ci/circleci: docs-python27 Your tests passed on CircleCI!
Details
ci/circleci: docs-python35 Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 50%)
Details
codecov/project/library 61.63% (target 50%)
Details
codecov/project/tests 98.72% (+0.04%) compared to 22cb2d4
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
lgtm analysis: Python No alert changes
Details

@clintval clintval deleted the clintval:cv_shadow_patch_zorder_init branch Oct 19, 2017

@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
You can’t perform that action at this time.