8000 Draw unfilled hist()s with the zorder of lines. by anntzer · Pull Request #17204 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Draw unfilled hist()s with the zorder of lines. #17204

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
Apr 23, 2020

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Apr 21, 2020

Unfilled hist()s (histtype="step") are technically drawn as Patches
with fill=False, but they are effectively lines and should therefore
be drawn above gridlines (like Line2D), not below (like Patch). Change
their default zorder accordingly.

from pylab import *
np.random.seed(0)
hist(np.random.randint(10, size=20), bins=range(10), histtype="step")
grid()

before:
old
after:
new

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

@anntzer anntzer added this to the v3.3.0 milestone Apr 21, 2020
Copy link
Member
@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Test?

Unfilled hist()s (`histtype="step"`) are technically drawn as Patches
with `fill=False`, but they are effectively lines and should therefore
be drawn above gridlines (like Line2D), not below (like Patch).  Change
their default zorder accordingly.
@anntzer
Copy link
Contributor Author
anntzer commented Apr 22, 2020

done :)

@timhoffm
Copy link
Member

I would have preferred to set this to a zorder: z_plot_lines > z > z_gridlines. Unfortunately, these are the same, so there is no value in between.

@timhoffm timhoffm merged commit 6372f1d into matplotlib:master Apr 23, 2020
@anntzer anntzer deleted the histstepzorder branch April 23, 2020 11:50
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
0