【问题标题】:Gnuplot 5.0 'set output filename' in a gnuplot script does not workGnuplot 脚本中的 Gnuplot 5.0“设置输出文件名”不起作用
【发布时间】:2015-09-17 21:33:00
【问题描述】:

我是 Gnuplot 的新手,从 gnuplot 5.0.0 开始。这是我的问题: 考虑一个非常简单的名为 save.gpl 的 gnuplot 脚本示例:

set terminal dumb  
plot sin(x) with linespoints pointtype 5, cos(x) w boxes lt 4  
set term png   
set output “graph.png”   
replot  
set term dumb

当我尝试从我的 mac (OX 10.0) 的 shell 终端运行此脚本时:
$ gnuplot save.gpl
它在第 4 行抛出错误(设置输出“graph.png”)说:

“save.gpl”,第 4 行:内部错误:STRING 运算符应用于非 STRING 类型。

当我尝试从 gnuplot 加载我的脚本时,也会发生同样的事情: gnuplot > 加载 save.gpl

但如果我在“gunplot >”模式下一次执行一个脚本中的每个命令,一切都会好起来的。

但是,我需要使用 设置输出“文件名.png” 在更大的脚本中多次声明以保存多个绘图。所以,必须在脚本中使用这个语句。

提前致谢。

【问题讨论】:

    标签: python gnuplot


    【解决方案1】:

    您使用了错误的引号。在你的脚本中有LEFT DOUBLE QUOTATION MARK (U+201C)RIGHT DOUBLE QUOTATION MARK (U+201D),这是错误的。

    您必须将 ' (ASCII 0x27) 或双引号 " (ASCII 0x22) 作为字符串分隔符,就像在任何脚本语言中一样。

    set terminal pngcairo
    set output "graph.png"
    plot sin(x)
    

    【讨论】:

    • 知道了,克里斯。谢谢。
    猜你喜欢
    • 2014-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多