拥有"自动"x

use*_*548 22 plot gnuplot

只是一个简单的问题(我想)但是,让我说我有以下数据文件:

# no x data, it's sampled for instance each second.
23 42 48 
49 89 33
39 44 97
Run Code Online (Sandbox Code Playgroud)

如何(如果可能的话)我可以如此绘制

1 23 42 48 
2 49 89 33
3 39 44 97
Run Code Online (Sandbox Code Playgroud)

使用1,2,3,..(第一列)作为x?

做类似的事情:plot "file.dat" using (lineNumber):3例如.

mgi*_*son 42

如果你不想依赖awk,gnuplot也可以这样做.见help plot datafile usinghelp plot datafile using pseudocolumns.尝试:

plot "file.dat" using (column(0)):3
Run Code Online (Sandbox Code Playgroud)

  • 你甚至可以使用`plot"file.dat"使用0:3` (13认同)

Rap*_*oth 15

例如,绘制数据文件的第三行:

plot "DATAFILE" u 3
Run Code Online (Sandbox Code Playgroud)

或者awk:

plot "<awk '{print FNR,$0}' DATAFILE" u 1:4 
Run Code Online (Sandbox Code Playgroud)

请注意,awk添加了亚麻布,因此第一列是亚麻布.

如果相同,gnuplot会自动使用x轴的行号