8000 Ensure errorbars are always drawn on top of bars in ax.bar by dstansby · Pull Request #14043 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Ensure errorbars are always drawn on top of bars in ax.bar #14043

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 4 commits into from
Apr 27, 2019

Conversation

dstansby
Copy link
Member

Fixes #14039 by ensuring the zorder of errorbars is always slightly larger than that of bars. Comments/questions:

  • If anyone has a neater way to write the code, suggestions welcome
  • This still allows the errorbar zorder to be set independently by passing error_kw
  • Does this need an API change or anything extra in the docs?

@dstansby dstansby added this to the v3.2.0 milestone Apr 25, 2019
Copy link
Member
@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

👍 to the idea, some kinks to work out + tests.

Don't think this needs an API change or whats_new, pretty clearly a bug fix.

@@ -6329,3 +6329,18 @@ def test_hist_range_and_density():
range=(0, 1), density=True)
assert bins[0] == 0
assert bins[-1] == 1


def test_bar_errbar_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.

I've checked that this test fails on master.

@timhoffm
Copy link
Member

Doc build is broken due to #14003 (unrelated to this PR).

@@ -2292,6 +2292,14 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
xerr = kwargs.pop('xerr', None)
yerr = kwargs.pop('yerr', None)
error_kw = kwargs.pop('error_kw', {})
ezorder = error_kw.pop('zorder', None)
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this pop if we are going to use setdefault.

I think the question is do we want to .bar(..., error_kw={'zorder': None}) to mean "please do not adjust the zorder and fall through the current behavior" or do we want it to me "do the new default thing and adjust the zorder".

I think we want the second here, but see arguments either way.

Copy link
Member

Choose a reason for hiding this comment

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

👍 for the second.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think for the second option (for which I am also 👍 ) the pop needs to stay?

@tacaswell tacaswell dismissed their stale review April 26, 2019 12:38

Concerns addressed, one small question, ok if this goes in as-is, but not going to push green button right now.

@dstansby dstansby force-pushed the bar-errbar-zorder branch from 31c286b to c92a99b Compare April 26, 2019 18:21
Copy link
Member
@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

just waiting on CI

@timhoffm
Copy link
Member

As a bugfix, this should go into 3.1.1.

@timhoffm timhoffm modified the milestones: v3.2.0, v3.1.1 Apr 27, 2019
@timhoffm timhoffm merged commit 2ca9461 into matplotlib:master Apr 27, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 27, 2019
@dstansby dstansby deleted the bar-errbar-zorder branch April 27, 2019 19:12
dstansby added a commit that referenced this pull request Apr 27, 2019
…043-on-v3.1.x

Backport PR #14043 on branch v3.1.x (Ensure errorbars are always drawn on top of bars in ax.bar)
@QuLogic QuLogic modified the milestones: v3.1.1, v3.1.0 Apr 27, 2019
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.

bar plot yerr lines/caps should respect zorder
4 participants
0