Plot 使用变量定义列时多点缩放

Plot 使用变量定义列时多点缩放,plot,gnuplot,Plot,Gnuplot,我从脚本stuff.pl中获取数据,并希望动态地绘制到一个图形中。因此,我将在Gnuplot(v4.6 patchlevel 3)中使用一个循环,这将导致以下问题: 使用文件TEST.gp: xCol=2; yCol=3 set term x11 1 plot '< stuff.pl' u xCol:yCol xCol=4; yCol=5 set term x11 1 set autoscale y replot '< stuff.pl' u xCol:yCol pause 1

我从脚本
stuff.pl
中获取数据,并希望动态地绘制到一个图形中。因此,我将在Gnuplot(v4.6 patchlevel 3)中使用一个循环,这将导致以下问题:

使用文件
TEST.gp

xCol=2; yCol=3
set term x11 1
plot '< stuff.pl' u xCol:yCol

xCol=4; yCol=5
set term x11 1
set autoscale y
replot '< stuff.pl' u xCol:yCol

pause 1
,其行为应与imo相同,缩放工作正常


我不理解这种行为。

replot调用上一个
plot
命令,然后添加另一个plot。在上一个plot命令中,变量没有被替换。当
replot
调用上一个绘图命令时,
xCol
yCol
的最后值将用于两个绘图

您可以使用两个不同的变量:

xCol1 = 2; yCol1 = 3
plot '< stuff.pl' u xCol1:yCol1

xCol2 = 4; yCol2 = 5
replot '< stuff.pl' u xCol2:yCol2
xCol1=2;yCol1=3
绘图“
也可以使用宏,这些宏将被替换

set macros
cols='2:3'
plot '< stuff.pl' u @cols

cols='4:5'
replot '< stuff.pl' u @cols
设置宏
科尔斯='2:3'
plot'
再次感谢您在Gnuplot相关主题@Christoph:)上提供的巨大帮助
set macros
cols='2:3'
plot '< stuff.pl' u @cols

cols='4:5'
replot '< stuff.pl' u @cols