Question

I'm quite new to python and I need some help. I would like to plot errorbars equivalent to 1sigma standard deviations on my plot as the 16th and 84th percentile values of the distributions. I tried with (using matplotlib):

err=np.std(x)

but it just gives me the standard deviations. Thanks.

Was it helpful?

Solution

If you want vertical error bars

 ax = plt.gca()
 ax.errorbar(x, y, yerr=np.vstack([error_low, error_high]))
 plt.draw()

where error_low and error_high are 1D sequences of the same length an x and y. The error bars are drawn at y[i] - error_low[i] and y[i] + error_high[i].

matplotlib just draws what you tell it to, it is your job to provide the semantics.

errorbar documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top