我有一个数据文件 (data.txt)。我可以使用 gnup 命令绘制数据。例如;
gnup -p data.txt -xl 'Hours' -yl 'Data (m)'
执行上述命令后,我需要保存绘图(例如 png 格式),但不绘制数据。可以吗?
答案1
gnuplot
有一个set output
命令,我用它来保存我的情节的副本:
#!/bin/bash
# Run this script after synching the Palm with $HOME/Visor/.last
# Weight - extract my weight data fron the Visor, clean it
# up, and feed it to gnuplot
target=$HOME/Visor/var/Weight
visorhome="$HOME/Visor"
gnuplotdata="${target}.pltdata"
gnuplotout="${target}.ps"
# ... data prep omitted - data to plot is in $gnuplotdata
gnuplot <<EOF
set title "Weight and running average, in kilograms, for Walt Sullivan"
set timefmt "%y/%m/%d"
set xdata time
set format x "%y/%m/%d"
plot "$gnuplotdata" using 1:2 with linespoints, "" using 1:3 with linespoints;
pause 10 "Plot will close in 10 seconds, see $gnuplotout"
set terminal postscript enhanced color landscape
set output "$gnuplotout"
replot
EOF
exit 0
要了解更多信息,请输入:
$ gnuplot
gnuplot> help set output
By default, screens are displayed to the standard output. The `set output`
command redirects the display to the specified file or device.
...