errorbar_demo.py
来自「非原创。很好的python例子」· Python 代码 · 共 32 行
PY
32 行
#!/usr/bin/env pythonfrom pylab import *t = arange(0.1, 4, 0.1)s = exp(-t)e = 0.1*abs(randn(len(s)))f = 0.1*abs(randn(len(s)))g = 2*eh = 2*ffigure(1) #errorbar(t, s, e, fmt='o') # vertical symmetric#errorbar(t, s, None, f, fmt='o') # horizontal symmetricerrorbar(t, s, e, f, fmt='o') # both symmetric#errorbar(t, s, [e,g], [f,h], fmt='--o') # both asymmetric#errorbar(t, s, [e,g], f, fmt='o', ecolor='g') # both mixed#errorbar(t, s, e, [f,h], fmt='o') # both mixed#errorbar(t, s, [e,g], fmt='o') # vertical asymmetric#errorbar(t, s, yerr=e, fmt='o') # named#errorbar(t, s, xerr=f, fmt='o') # namedxlabel('Distance (m)')ylabel('Height (m)')title('Mean and standard error as a function of distance')figure(2)ax = subplot(111)ax.set_yscale('log')errorbar(t, s+2, e, f, fmt='o') # both symmetric#savefig('errorbar_demo')show()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?