根据这个问题给出的答案Gnuplot 平滑置信区间线而不是误差线我能够得到与给出的数据相同的结果(y 的误差是对称的,因此它是 y 加/减 errorY):
# x y errorY
1 3 0.6
2 5 0.4
3 4 0.2
4 3.5 0.3
Code:
set style fill transparent solid 0.2 noborder
plot 'data.dat' using 1:($2-$3):($2+$3) with filledcurves title '95% confidence', \
'' using 1:2 with lp lt 1 pt 7 ps 1.5 lw 3 title 'mean value'
现在,通过连接每个 y+errorY 和 y-errorY 点给出置信带。如果连接不仅仅是一条直线,而是一条平滑的线,就像如何平滑数据点一样,我希望它smooth csplines
..
这有点棘手,因为平滑仅适用于单个列,并且不能直接与filledcurves
绘图风格。
因此,您必须首先通过绘制平滑的置信上限和下限来生成两个临时数据文件,以将数据文件与
set table 'lower.dat'
plot 'data.dat' using 1:($2-$3) smooth cspline
set table 'upper.dat'
plot 'data.dat' using 1:($2+$3) smooth cspline
unset table
然后将这两个文件与paste lower.data upper.dat
在绘制数据之前。如果您没有paste
命令行程序,您还可以使用任何其他脚本,例如paste.py合并文件:
set terminal pngcairo
set output 'data.png'
set style fill transparent solid 0.2 noborder
plot '< paste lower.dat upper.dat' using 1:2:5 with filledcurves title '95% confidence', \
'data.dat' using 1:2 with lines lt 1 smooth cspline title 'mean value',\
'' using 1:2 with points lt 1 pt 7 ps 1.5 lw 3 title 'data points'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)