Skip to content

Asymmetric error bars are not supported for series (only dataframes) #9536

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

Closed
mizzao opened this issue Feb 23, 2015 · 4 comments · Fixed by #34514
Closed

Asymmetric error bars are not supported for series (only dataframes) #9536

mizzao opened this issue Feb 23, 2015 · 4 comments · Fixed by #34514

Comments

@mizzao
Copy link

mizzao commented Feb 23, 2015

According to the documentation, asymmetric error bars should be able to be passed in to plot as an Mx2 array for a Series object or a Mx2xN array for a DataFrame object.

However, the code only seems to parse this correctly for a DataFrame: https://github.com/pydata/pandas/blob/master/pandas/tools/plotting.py#L1338

When passing raw error values as yerr, it seems that the first values are used as two-sided error differences, instead of being plotted as raw upper and lower values. Note the symmetric error bars below:

image

Using the underlying matplotlib function directly yields the expected results, but without the pandas-generated decorations:

image

This was originally noted in this StackOverflow question and I corroborated the other user's experience.

@ericmjl
Copy link

ericmjl commented Nov 3, 2015

I am having a similar issue here.

@TomAugspurger
Copy link
Contributor

Anyone interested in submitting a fix? I can help you out if you run into trouble.

@ericmjl
Copy link

ericmjl commented Nov 3, 2015

I'm happy to try!

@TomAugspurger: I've been a user of pandas for a while, but I think I might need some guidance to the codebase. Would you be kind enough to pinpoint roughly where I should get started?

@TomAugspurger
Copy link
Contributor

Thanks!

The plotting code is all in pandas/tools/plotting.py The logic for parsing error bars should all be here so that's were I'd start.

@jreback jreback modified the milestones: 0.18.1, 0.18.0, Next Major Release Feb 10, 2016
kleingeist added a commit to kleingeist/pandas that referenced this issue Apr 2, 2016
This fix is for handling asymmetric error bars for series.
It adapts to the syntax for
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.errorbar
where a sequence of shape 2xN is expected in case of asymmetric error bars.

If a single series is to be plotted and the error sequence is of shape 2xN
it will be used as asymmetric error bars.
Previously a 2xN error sequence was assumed to be 2 symmetric error sequences
for 2 series. Thus in the end only the first error sequence was used.

This commit improves the docstring of the `_parse_errorbars` method as well
as the general pandas doc on error bars.
@jreback jreback modified the milestones: Contributions Welcome, 1.1 Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants