Plot error bars (percentile)

老子叫甜甜 提交于 2020-08-20 07:00:48

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/15071259/plot-error-bars-percentile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!