【问题标题】:How to draw a dataset with fill transparent style in Gnuplot如何在 Gnuplot 中绘制具有填充透明样式的数据集
【发布时间】:2014-07-04 16:01:16
【问题描述】:

我正在运行一个简单的 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 使用什么样的语法来改变风格。我可以毫无问题地设置线条,但无法设置填充。

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    尝试以下命令:

    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
    

    或者(如上,但将情节线改为):

    plot sin(x) w filledcurves below y1=1.0
    

    如果您在情节线中使用w filledcurves ...,您也不需要包含set style function filledcurves above y1=0.0,但是您可以(如果您使用情节线,您也可以删除情节线的w filledcurves ...前面提到的行。

    通常在 gnuplot 中,您可以将命令放在多行上并省略分号。如果您在一个不错的 linux 系统上,应该可以创建一个脚本文件,例如 graph.gnu,将脚本行和附加行 #!/usr/bin/gnuplot -p 添加到文件的最顶部,然后使用 @987654328 @。该脚本现在可以执行并且应该显示您的图表。

    【讨论】:

    • 像魅力一样工作,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    • 2020-08-19
    • 2011-10-22
    • 1970-01-01
    • 1970-01-01
    • 2021-11-30
    相关资源
    最近更新 更多