我有一个形式的数据集
x,y,z,zerr
并希望生成一个三维图,其中包括z值上的误差线。所以我想要的是这样的情节
splot "datafile.dat" using 1:2:3
它给出了规则的3D图,但还应包括误差线。我尝试使用
splot "datafile.dat" using 1:2:3:4 with errorbars
但这只会再次生成相同的图,不会显示任何误差线。在Gnuplot中有没有办法做到这一点?如果没有,有没有办法在Python中使用matplotlib做到这一点?如果是这样,我可能会改用它。
Gnuplot确实具有3D绘图样式zerror
,其中包括绘制为阴影区域而不是单个条形的误差范围。否则,您将不得不在单独的图子句中构造点,线和误差线。请注意,用于3D矢量的输入数据规范为x y z delta-x delta-y delta-z
。为了将zerror变量与其他变量分开,我将x值强制设置为0或1。
set view 60, 120
set xyplane at 0
set grid x y z vertical linewidth 1
set yrange [200:500]
set xrange [1.5 : 0]
set style fill transparent solid 0.25
set style arrow 1 heads size screen 0.005, 90
set style arrow 1 lc "blue" lw 1.5
splot 'DATA' using (0):2:3:4 with zerror title "with zerror", \
'' using (1):2:3 with lines title "with lines", \
'' using (1):2:3 with points pt 7 lc "black" title "with points", \
'' using (1):2:($3-$4):(0):(0):(2.*$4) with vector as 1 title "with vectors"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句