Gnuplot 语法错误:多个绘图,其中一个是带有星号模式的for循环

Gnuplot 语法错误:多个绘图,其中一个是带有星号模式的for循环,gnuplot,Gnuplot,给定以下数据文件datafile.txt "distance bus1 bicycle1" 12.1 16.29994171768731 15.0 23.23394929838676 20.0 17.63884633415712 25.0 2.2977170652861667 30.0 22.638830796409298 35.0 37.904820273943606 38.2 49.68696609775994 "distance bus1 bicycle2" 12.1 10.38923

给定以下数据文件
datafile.txt

"distance bus1 bicycle1"
12.1 16.29994171768731
15.0 23.23394929838676
20.0 17.63884633415712
25.0 2.2977170652861667
30.0 22.638830796409298
35.0 37.904820273943606
38.2 49.68696609775994


"distance bus1 bicycle2"
12.1 10.389230000341742
15.0 15.82783623872837
20.0 11.262011365648817
25.0 2.3291889288592533
30.0 25.930554010842158
35.0 45.36376748022544
38.2 57.535263969151465
这个命令有效

plot for [i=0:1] 'datafile.txt' index i with lines title columnheader(1), 1.0 with lines title "collision limit"
此命令也起作用

plot for [i=0:*] 'datafile.txt' index i with lines title columnheader(1)
但将*和逗号组合在一起会在gnuplot中产生语法错误:

plot for [i=0:*] 'datafile.txt' index i with lines title columnheader(1), 1.0 with lines title "collision limit"

知道我做错了什么吗?我正在使用gnuplot 5.2 patchlevel 7。

我无法解释为什么会发生这种情况,可能是某种错误,但我可以提供一种解决方法:

plot for [i=0:*] 'datafile.txt' index i with lines title columnheader(1), \
     '+' using 1:(1.0) with lines title "collision limit"

注意:该错误现在已在上游修复,修复程序将首先出现在gnuplot 5.2.8的
*
循环中,例如,
为[i=0:].
绘图在其他情况下也会导致问题(至少我遇到过这种情况)。然而,另一个解决方法是以下方法,代价是
stats
进行一些额外的计算。然后,您可以使用变量
STATS\u blocks
,它应该告诉您数据集的数量,即最大索引等于
STATS\u blocks-1

FILE = 'datafile.txt'
stats FILE nooutput
plot for [i=0:STATS_blocks-1] FILE index i with lines title columnheader(1), \
     1.0 with lines title "collision limit"

theozh和Ethan的两个答案都很好,但我只能接受一个答案,对吗?我选择theozh是因为从长远来看,回避似乎更为有效。谢谢你们两个!
FILE = 'datafile.txt'
stats FILE nooutput
plot for [i=0:STATS_blocks-1] FILE index i with lines title columnheader(1), \
     1.0 with lines title "collision limit"