[英]Gnuplot 3d surface plot
我有一个 x、y、z 点的文本,我想用它绘制一个 3d 表面 plot。 但是,计算这些点的代码有时会给出零值的坐标(准确地说是 0.000000000000000000e+00)。 我试图忽略它们使用
set datafile missing '0.000000000000000000e+00'.
结果是曲面 plot 继续朝向 (0,0,0) 点。 在非零值的情况下,plot 似乎工作正常。 这是我目前使用的 gnuplot 脚本:
set title "Thermal efficiency versus maximum cycle pressure and expander inlet temperature"
set grid
set key top left
#set key off
set view 60,60
set xlabel "phigh [MPa]"
set ylabel "T3 [oC]"
set zlabel "nth [-]"
#set xrange[0.0:0.0]
#set yrange[0.0:0.0]
#set zrange[0.0:0.0]
set datafile missing '0.000000000000000000e+00'
set dgrid3d 100,100
#set hidden3d
#set palette model CMY rgbformulae 7,5,15
set palette rgbformulae 33,13,10
#splot "performance_parameters.txt" using ($1/1000000.0):($2-273.15):($3) notitle with points palette pointsize 1 pointtype 7
splot "performance_parameters.txt" using ($1/1000000.0):($2-273.15):($3) notitle with lines palette
#splot "performance_parameters.txt" using ($1/1000000.0):($2-273.15):($3) notitle with points palette pointsize 1 pointtype 7
我想知道是否有另一种方法可以跳过零坐标线。
工作示例 plot
先感谢您。
如果我set datafile missing "0.000000000000000000e+00"
,它对我来说很好(gnuplot 5.2.8)。 我猜该字符串必须与数据中的字符串值完全匹配。 好吧,另一种方法是定义一个函数,如果数据值为0
则返回NaN
。 所以左图包含0
而其他图不包含0
。
代码:
### exclude data with 0 values
reset session
$Data <<EOD
1 1 0.1
1 2 0.3
1 3 0.2
2 1 0.5
2 2 1.3
2 3 1.2
0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00
3 2 0.9
3 3 0.7
EOD
set dgrid3d 20,20
myNonZero(col) = column(col) == 0 ? NaN : column(col)
unset colorbox
set multiplot layout 1,3
splot $Data u 1:2:3 w l palette
set datafile missing "0.000000000000000000e+00"
splot $Data u 1:2:3 w l palette
splot $Data u (myNonZero(1)):2:3 w l palette
unset multiplot
### end of code
结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.