登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
参考Origin官网 Error Bars with Fill Area的例子(http://www.originlab.com/doc/Tutorials/ErrorBar-FillArea),使用MILab绘制了一下误差棒填色图,绘图数据参考上述链接。
脚本程序如下:
- #add data
- fn = r'H:\test\error bars with Fill Area\Error Bars with Fill Area.txt'
- ncol = numasciicol(fn)
- nrow = numasciirow(fn)
- a = asciiread(fn,shape=(nrow,ncol))
- a[a==-999]= nan
- data = a[:,0]
- error = a[:,1]
- data1 = a[:,2]
- error1 = a[:,3]
- data2 = a[:,4]
- error2 = a[:,5]
- x = arange(len(data))
- #plot
- axes(tickfontsize=18)
- antialias(True)
- #errorbar(x,data,error,color='r',marker='D',linewidth=3)
- #errorbar(x,data1,error1,color='b',marker='S',linewidth=3)
- #errorbar(x,data2,error2,color='m',marker='D',linewidth=3)
- line1 = plot(x,data,color='g',linewidth=2,label='Effective Force')
- line2 = plot(x,data1,color='r',linewidth=2,label='ineffective Force')
- line3 = plot(x,data2,color='b',linewidth=2,label='Total Force')
- fill_between(x,data+error,data-error,color='g', alpha=0.3)
- fill_between(x,data1+error1,data1-error1,color='r', alpha=0.3)
- fill_between(x,data2+error2,data2-error2,color='b', alpha=0.3)
- line = [line1,line2,line3]
- legend(line,fontsize=18,markerscale=2,framon=True)
- xlim(0,350)
- ylim(-300,450)
|