使用 Gnuplot 绘制数据文件时如何使用整数 1 到 n 作为列?

How to use the integers 1 to n as a column when plotting a data file with Gnuplot?

假设我有一个这样的文件 "data.dat":

#Time          Velocity
1              24
1              26
1              28

现在,我需要在 gnuplot 中绘制第 2 列。它必须绘制在从 1 到 n 的自然数上,所以在这种情况下是从 1 到 3。一般来说,我可以将以下 gnuplot 与以下内容一起使用:

plot "data.dat" using 1:2

但我不想使用第 1 列,而是使用数字 1 到 3。我该如何以一种聪明的 gnuplot 内部方式做到这一点?如果那不可能,使用 bash 添加从 1 到 3 的列的最佳方法是什么(在使用诸如 cat data.dat | awk '{ print }' > new_data.dat 从 data.dat 到第 2 列之后)?

第零列(伪列)包含行号(从 0 开始):

plot "data.dat" using ([=10=] + 1):2