-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Comments
I am having a similar issue here. |
Anyone interested in submitting a fix? I can help you out if you run into trouble. |
I'm happy to try! @TomAugspurger: I've been a user of |
Thanks! The plotting code is all in |
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.
According to the documentation, asymmetric error bars should be able to be passed in to
plot
as an Mx2 array for aSeries
object or a Mx2xN array for aDataFrame
object.However, the code only seems to parse this correctly for a
DataFrame
: https://github.com/pydata/pandas/blob/master/pandas/tools/plotting.py#L1338When 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:Using the underlying matplotlib function directly yields the expected results, but without the pandas-generated decorations:
This was originally noted in this StackOverflow question and I corroborated the other user's experience.
The text was updated successfully, but these errors were encountered: