如何在Gnuplot中绘制填充透明样式的数据集

如何在Gnuplot中绘制填充透明样式的数据集,gnuplot,Gnuplot,我正在运行一个简单的sin(x)函数[-10:10],希望输出为透明填充,而不仅仅是行 这个例子并不清楚该做什么;因为当我在gnu plot提示符下键入此命令时,我会得到带有以下行的标准绘图: set style fill transparent solid 0.5 noborder; plot [-10:10] sin(x) 如果我在sin(x)之后添加任何内容,我会得到一个错误,即;这是意料之中的事。如果我加上,;像 set style fill transparent solid 0.5

我正在运行一个简单的sin(x)函数[-10:10],希望输出为透明填充,而不仅仅是行

这个例子并不清楚该做什么;因为当我在gnu plot提示符下键入此命令时,我会得到带有以下行的标准绘图:

set style fill transparent solid 0.5 noborder; plot [-10:10] sin(x)
如果我在sin(x)之后添加任何内容,我会得到一个错误,即;这是意料之中的事。如果我加上,;像

set style fill transparent solid 0.5 noborder; plot [-10:10] sin(x); fs solid 0.5
我得到一个错误,说命令无效


我知道这不是火箭科学,但我真的不知道Gnuplot使用什么样的语法来改变样式。我可以毫无问题地设置线条,但无法设置填充。

尝试使用以下命令:

set xrange [-10:10]
set style function filledcurves above y1=0.0
set style fill transparent solid 0.5 noborder
plot sin(x) w filledcurves above y1=0.0, sin(x) w filledcurves below y1=0.0 ls 1
或(如上所述,但将打印线更改为):

如果在打印线中使用
w filledcurves…
,则不需要在y1=0.0以上包含
set style函数filledcurves…
,但可以(如果使用前面提到的线,还可以删除打印线的
w filledcurves…
部分)


通常在gnuplot中,您可以在多行上放置命令并省略分号。如果您使用的是好的linux系统,那么应该可以创建一个脚本文件,比如
graph.gnu
,将脚本的行和附加行
#!/usr/bin/gnuplot-p
添加到文件的最顶端,然后使用
chmod+x graph、 gnu
。该脚本现在可以执行,应该可以显示您的图形。

非常有效,谢谢!
plot sin(x) w filledcurves below y1=1.0