Skip to content

Fix default colouring of Shadows #17656

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 2 commits into from
Jun 17, 2020
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Jun 17, 2020

PR Summary

Starting with #16098, extra keyword arguments are now processed, but that means that default colours and alpha are not set. Instead, those properties should only be overridden if specified.

As a proof that this works as one might expect, change the Shadow call in pie to use keyword arguments instead of .set.

This is not a perfect match to previous behaviour, but at least makes the constructor work in an expected manner.

PR Checklist

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

QuLogic added 2 commits June 16, 2020 23:38
Starting with matplotlib#16098, extra keyword arguments are now processed, but
that means that default colours and alpha are not set. Instead, those
properties should only be overridden if specified.
A `Shadow` already sets zorder immediately below its parent patch, so
that's no longer necessary.
@QuLogic QuLogic added this to the v3.3.0 milestone Jun 17, 2020
@@ -3076,8 +3076,7 @@ def get_next_color():
if shadow:
# Make sure to add a shadow after the call to add_patch so the
# figure and transform props will be set.
shad = mpatches.Shadow(w, -0.02, -0.02)
shad.set(zorder=0.9 * w.get_zorder(), label='_nolegend_')
shad = mpatches.Shadow(w, -0.02, -0.02, label='_nolegend_')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don‘t we need zorder?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadow sets a default zorder (immediately below the parent patch) that's better than this manually calculated one.

@tacaswell tacaswell merged commit 6e7dd77 into matplotlib:master Jun 17, 2020
@QuLogic QuLogic deleted the pie-shadow branch June 17, 2020 21:52
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.

3 participants