python - Gnuplot 脚本中的 Gnuplot 5.0 'set output filename' 不起作用

标签 python gnuplot

我是 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 保存.gpl
它在第 4 行(设置输出“graph.png”)抛出一个错误:

"save.gpl", line 4: internal error : STRING operator applied to non-STRING type.

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

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

但是,我需要使用 设置输出“filename.png” 在更大的脚本中多次声明以保存多个情节。所以,不得不在脚本中使用这条语句。

提前致谢。

最佳答案

您使用了错误的引号。在你的脚本中你有 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)

关于python - Gnuplot 脚本中的 Gnuplot 5.0 'set output filename' 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32640317/

相关文章:

Python 时区感知日期时间和 UTC 转换

python - pdb:在不在 sys.path 中的文件上设置断点

datetime - 无法使用日期/时间字段在 Gnuplot 中绘制烛台数据

gnuplot - 自动为任意数量的 block 添加标题

gnuplot - gnuplot 条形图中不同颜色的条形?

python - Pandas DataFrame 日期系列到列表的转换

python - Tkinter 和 openpyxl 错误没有这样的文件或目录 ''

python - Pygame,在使用 convert_alpha() 导入的图像上设置透明度

fonts - 带有 Times-Roman 字体的 gnuplot 埃标签

bash - 如何告诉 gnuplot 不要在屏幕上打印合适的日志?