绘制误差线(百分位) [英] Plot error bars (percentile)

查看:105
本文介绍了绘制误差线(百分位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 python 很陌生,我需要一些帮助.我想在我的图上绘制相当于 1sigma 标准差的误差线作为分布的第 16 个和第 84 个百分位值.我尝试过(使用 matplotlib):

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.

推荐答案

如果你想要垂直误差线

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

其中error_lowerror_high 是与xy 长度相同的一维序列.误差线绘制在 y [i]-error_low [i] y [i] + error_high [i] 处.

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 只是绘制你告诉它的内容,提供语义是你的工作.

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

错误栏文档

这篇关于绘制误差线(百分位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆