尝试保存图片时 Gnuplot 显示垃圾

Spi*_*ast 1 gnuplot

当我在 gnuplot 窗口中输入以下内容时:

set xlabel "x"; set ylabel "y"; 
plot "rk1000.dat" with lines, "teor1000.dat" with lines
Run Code Online (Sandbox Code Playgroud)

结果是一个不错的情节。但是,当我尝试将其另存为 .png 文件时,结果不太好。打字后

set xlabel "x"; set ylabel "y"; set terminal png size 800,600; 
plot "rk1000.dat" with lines, "teor1000.dat" with lines
Run Code Online (Sandbox Code Playgroud)

结果是 gnuplot 吐出垃圾字符并且什么也不做。这是一个屏幕截图:在此输入图像描述

我该如何解决?就在一个小时前,我保存我的地块也没有任何问题。

Tom*_*ech 5

您可以set output在脚本中使用 gnuplot 将输出重定向到文件:

set terminal png size 800,600
set output "plot.png"
plot "rk1000.dat" with lines, "teor1000.dat" with lines
Run Code Online (Sandbox Code Playgroud)

如果您使用 gnuplot 创建 png 图像,“pngcairo”终端会产生更好看的结果。尝试set terminal查看可用终端的列表。