-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
There was a problem hiding this 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(): |
There was a problem hiding this comment.
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
.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for the second.
There was a problem hiding this comment.
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?
Concerns addressed, one small question, ok if this goes in as-is, but not going to push green button right now.
31c286b
to
c92a99b
Compare
There was a problem hiding this 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
As a bugfix, this should go into 3.1.1. |
…p of bars in ax.bar
…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)
Fixes #14039 by ensuring the zorder of errorbars is always slightly larger than that of bars. Comments/questions:
error_kw