如何使用 Gnuplot 打印带有误差线和不同线点的 3D 图(点)

How to use Gnuplot to print 3D plots (splot) with error bars and different linespoints

使用Gnuplot绘制带有splot的3D图表和带有zerror的错误不允许我们有不同的点线。 Here are examples. I would like to use splot with error bars and still differentiate lines by different points. Like it is mentioned here:

The operation of with is also the same as in plot, except that the plotting styles available to splot are limited to lines, points, linespoints, dots, and impulses; the error-bar capabilities of plot are not available for splot.

Gnuplot 中是否有针对此问题的其他解决方案?

正如您所注意到的,似乎没有用于在 3D 中绘制误差线的直接绘图样式。可以将输入数据操作为 pseudo-draw 带有线条样式的误差线。

示例脚本:

$inputdata <<EOD
# x y z zlow zhigh
1 1 1 0 2
2 1 2 1 3
3 1 3 2 4
4 1 4 3 5
5 1 5 4 6


1 2 5 1 7
2 2 4 1 7
3 2 3 1 7
4 2 2 1 7
5 2 1 1 7


1 3 3 1 4
2 3 3 2 5
3 3 3 3 6
4 3 3 2 5
5 3 3 1 4
EOD

# construct errorbar's line segments data
set table $first
plot $inputdata using 1:2:4:(-0.1):4:5:0 with table
set table $second
plot $inputdata using 1:2:5:(+0.1):4:5:0 with table
unset table

# summarize data into data block $errbars
stats $inputdata using 0 nooutput
set print $errbars 
do for [i=1:STATS_records] {
  print $first[i]
  print $second[i]
  print ""
  print ""
}
set print

set xrange [0:6]
set yrange [0:4]

set key noautotitle

splot $inputdata using 1:2:3:2 with linespoints pt 7 lc variable, \
      $errbars   using 1:2:3:2 with lines lc variable, \
      $errbars   using 4:2:5:2 with lines lc variable, \
      $errbars   using 4:2:6:2 with lines lc variable

pause -1

它使用数据点和误差范围的 line-wise 数据 (x,y,z,zlow,zhigh) 作为输入来构建数据以绘制误差线和晶须。完成后,我们可以用线条样式绘制错误栏的每个部分。

结果:


这是另一个使用矢量样式的解决方案,实际上比上面的脚本简单得多。

示例脚本:

$inputdata <<EOD
# x y z zlow zhigh
1 1 1 0 2
2 1 2 1 3
3 1 3 2 4
4 1 4 3 5
5 1 5 4 6


1 2 5 1 7
2 2 4 1 7
3 2 3 1 7
4 2 2 1 7
5 2 1 1 7


1 3 3 1 4
2 3 3 2 5
3 3 3 3 6
4 3 3 2 5
5 3 3 1 4
EOD

set xrange [0:6]
set yrange [0:4]

unset key
set style arrow 3 heads size 0.05,90 lc variable

splot $inputdata using 1:2:3:2 with linespoints pt 7 lc variable, \
      $inputdata using 1:2:4:(0):(0):(-):2 with vectors arrowstyle 3 

pause -1

谢谢。