0

只是想知道我是否可以用不扭曲图形特征的颜色/选项来填充曲线下的区域,我尝试了 no fill 使用 solid/impulses 样式填充。欢迎任何建议!

刚刚使用:splot w lines lc rgb "dark-violet"

4

2 回答 2

0

您可以使用多边形来制作曲线。
这是使用多边形的示例:

set terminal wxt size 600,400

#set title "Graph Title"
#set xlabel "X"
#set ylabel "Y"
#set ylabel "Z"

# sets background color
set object 1 rectangle from screen -0.1,-0.1 to screen 1.1,1.1 fillcolor rgb "#ffffff" behind

# allows rendering of polygons with hidden line removal
set hidden3d back offset 0 trianglepattern 2 undefined 1 altdiagonal bentover

# displays borders 0x7F = 0b1111111
set border 0x7F linecolor rgb "#555555"

# displays the x, y and z axis
#set xzeroaxis linewidth 0.5 linetype 1
#set yzeroaxis linewidth 0.5 linetype 2
#set zzeroaxis linewidth 0.5 linetype 3

# displays the x, y and z grid
set grid xtics linecolor rgb "#888888" linewidth 0.2 linetype 9
set grid ytics linecolor rgb "#888888" linewidth 0.2 linetype 9
set grid ztics linecolor rgb "#888888" linewidth 0.2 linetype 9

# moves the x, y grid to 0
set xyplane at 0

# makes the x, y, and z axis proportional
#set view equal xyz

# moves the key out of the graph
set key outside vertical bottom right

splot "Data.dat" title "Data" with lines linewidth 1.0 linecolor rgb "#8888FF"

数据.dat:

0.000000 0.000000 4.562285
0.000000 0.000000 0.000000

1.000000 0.000000 2.139039
1.000000 0.000000 0.000000

2.000000 0.000000 3.120719
2.000000 0.000000 0.000000


0.000000 1.000000 2.562285
0.000000 1.000000 0.000000

1.000000 1.000000 4.139039
1.000000 1.000000 0.000000

2.000000 1.000000 3.120719
2.000000 1.000000 0.000000


0.000000 2.000000 2.562285
0.000000 2.000000 0.000000

1.000000 2.000000 1.139039
1.000000 2.000000 0.000000

2.000000 2.000000 3.120719
2.000000 2.000000 0.000000

由搅拌机和 python 脚本生成:
https ://github.com/lowlevel86/blender-to-gnuplot

如果要读取顶点数据而不是多边形数据,也可以使用命令行工具。您可以将 gnuplot 文件中的“Data.dat”替换为:

"<grep -E '[0-9]' Data.dat | awk '{print $1 \" \"$2\" \"$3; print $1\" \"$2\" 0.0\\n\"}'"

或者可能

"<grep -E '[0-9]|^$' Data.dat | awk '{print (!NF)?\"\":$1 \" \"$2\" \"$3\"\\n\"$1\" \"$2\" 0.0\\n\"}'"
于 2017-09-23T10:00:12.317 回答
0

这是一个丑陋的黑客,但它有点工作:绘制每条迹线两次,一次作为曲线,一次作为纯白色“墙”,它将覆盖它后面的任何东西。后者需要稍微滥用filledcurves3-d 情节中的情节风格。您必须手动处理深度排序,因此您必须从后到前绘制。

例子:

f(x,t)=exp(-(x-t)**2)   # some function in lieu of data

set xr [-10:20]
set yr [-0.5:10.5]
set zr [0:1]

set xlabel "x"  
set ylabel "t"
set xyplane at 0

set samples 1000
unset key

set multiplot
do for [t=10:0:-1] {
   splot  '+' using 1:(t):(f($1,t)) w filledcurves lc rgb "white" lw 1
   if (t == 10) {    # after first splot, do not plot borders and tics again
      unset border
      unset xtics
      unset ytics
      unset ztics
      unset xlabel
      unset ylabel
      unset zlabel
   }
   splot  '+' using 1:(t):(f($1,t)) w l ls 1
}
unset multiplot

在此处输入图像描述

于 2017-09-22T21:29:21.250 回答