Reputation: 41
I have only a few values on my x-axis so my error bars on my data points are competing with each other. I am not using Excel, rather Python, and would like to know how to plot only the top half or bottom half of the error bars so it's easier to read. Setting uplims = True does me no good, the bottom half of the error bars are still visible.
Upvotes: 4
Views: 6801
Reputation: 6472
When you pass the error bar information to the plotting function using a keyword argument such as yerr
you can specify the positive and negative error bars separately as iterables that have the same length as your data. For example if you had 3 points in your scatter plot with x and y values of xdata
and ydata
respectively, this code would give you positive error bars for each point that had a height of 5:
ax.bar(xdata, ydata, yerr=[(0,0,0), (5,5,5)])
Conversely, if you wanted only negative error bars you could do this:
ax.bar(xdata, ydata, yerr=[(5,5,5), (0,0,0)])
Upvotes: 10