是的,似乎有 - 有一个称为宏(help macros
in )的工具,其中可以通过在其名称前添加(“at”字符)来gnuplot
扩展字符串变量。@
默认情况下禁用此功能,因此需要考虑启用它。这就是为什么最好将该序列保存在一个初始化脚本文件中,例如init.gp
:
print ""
print "init.gp starting"
set terminal x11
# define capt string variable as sequence
# of commands, semicolon separated
capt = "print 'Saving...' ; set terminal png ; set output 'gnuplot.png' ; replot ; set terminal x11"
print "macros state: "
show macros
print "enabling macros state:"
set macros
show macros
print "The @capt command should be available now."
print ""
print "init.gp ending"
print ""
然后可以在以下位置进行这样的终端会话gnuplot
:
$ gnuplot
G N U P L O T
[...]
Terminal type set to 'wxt'
gnuplot> load "init.gp"
init.gp starting
macros state:
command line macros will not be expanded
enabling macros state:
command line macros will be expanded
The @capt command should be available now.
init.gp ending
gnuplot> plot sin(x)
gnuplot> @capt
Saving...
Terminal type set to 'png'
Options are 'nocrop font /usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf 12 size 640,480 '
Terminal type set to 'x11'
Options are ' nopersist'
gnuplot> plot cos(x)
Closing gnuplot.png
gnuplot> exit
$ identify gnuplot.png
gnuplot.png PNG 640x480 640x480+0+0 8-bit PseudoClass 102c 5.58KB 0.000u 0:00.000
好吧,希望这对某人有所帮助,
干杯!