0
votes

I want to plot asymmetrical errorbars with pandas. According to official docs this should work

df = pd.DataFrame([[1,0.2,0.7]])
fig, ax = plt.subplots()
df[0].plot.bar(yerr=[df[1], df[2]], ax=ax)

But pandas renders errorbar as df[1] for both lower and upper limits (-0.2/+0.2 istead of -0.2/+0.7):

enter image description here

Where do I make a mistake?

I use pandas v0.20.3 with python v2.7.13 under Windows 7.

1

1 Answers

5
votes

Your yerr is 1D:

yerr=[df[1], df[2]]

It needs to be 2D, specifically one row per data point and each row having two values for negative and positive error:

yerr=[[df[1], df[2]]]