gnuplot自动生成所有数据集的图例

gnuplot自动生成所有数据集的图例,gnuplot,legend,Gnuplot,Legend,我想知道如何使用下面的“option-1”绘图命令自动生成图例。我得到三条曲线,但只有一个图例名称,即仅显示“Y0” 使用“option-2”,我可以获得所有图例名称,但我不喜欢这种用于大型数据集的方法 打印文件的内容: “数据集”文件的内容: 文本文件 不确定如何修复选项1,但您可以使用for循环为大型数据集自动化选项2: N=2 # last index plot for [i=0:N] "dataset" skip 1 index i using 1:2 title columnhe

我想知道如何使用下面的“option-1”绘图命令自动生成图例。我得到三条曲线,但只有一个图例名称,即仅显示“Y0”

使用“option-2”,我可以获得所有图例名称,但我不喜欢这种用于大型数据集的方法

打印文件的内容:



“数据集”文件的内容:


文本文件

不确定如何修复选项1,但您可以使用
for
循环为大型数据集自动化选项2:

N=2 # last index
plot for [i=0:N] "dataset" skip 1 index i using 1:2 title columnhead with linespoints

谢谢你,乔斯!这帮了大忙。
#index_0
X0      Y0
0       1
1       2
2       3
3       4


#index_1
X1       Y1
0        2
1        3
2        4
3        5


#index_2
X2        Y2
0         3
1         4
2         5
3         6
N=2 # last index
plot for [i=0:N] "dataset" skip 1 index i using 1:2 title columnhead with linespoints