gnuplot:for和columnheader命令

Chr*_*Bao 4 for-loop gnuplot columnheader

我打算绘制多列数据文件.用第1列和第i列绘制xy图.所以基于手册的工作命令.哪个gnuplot版本开始有这样的功能?我的机器安装版本4.2,但无法正常工作.对于columnheader()的同样问题,
我想确保它是我的代码问题或版本.

Chr*_*oph 12

版本4.2已经具有该columnheader功能.

考虑data.txt包含的数据文件

first second third fourth
1 2 3 4
2 3 4 5
3 4 5 6
Run Code Online (Sandbox Code Playgroud)

在gnuplot 4.2中你可以使用例如

set key autotitle columnheader
set style data lines
plot 'data.txt' using 1:2, '' using 1:3, '' using 1:4
Run Code Online (Sandbox Code Playgroud)

从4.4版开始,您可以在plot命令中使用迭代:

set key autotitle columnheader
set style data lines
plot for [i=2:4] 'data.txt' using 1:i
Run Code Online (Sandbox Code Playgroud)

除了使用之外,set key autotitle columnheader您还可以使用title columnheader或者title columnheader(i+1)如果标题列与using语句中给出的列不匹配.这也至少从4.2开始起作用.