微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

使用Gnuplot来绘制带有splot的3D图表和带有zerror错误,这使我们不能用不同的点线。 Here是示例。我想将splot与误差线一起使用,并仍然通过不同的点来区分线。就像提到的here

with的操作也与plot中的相同,除了 可用的绘图样式仅限于线,点, 线点,点和脉冲;绘图的误差线功能 无法用于绘图。

Gnuplot中是否有针对此问题的另一种解决方案?

解决方法

您注意到,似乎没有直接绘制样式来绘制3D中的误差线。可以操纵输入数据以线型伪绘制误差线。

示例脚本:

$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:($1-0.1):4:5:0 with table
set table $second
plot $inputdata using 1:2:5:($1+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

它使用数据点和误差范围的逐行数据(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):($5-$4):2 with vectors arrowstyle 3 

pause -1

谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。