我打算绘制多列数据文件,使用第一列和第i列绘制xy图。因此,命令需要根据手册来工作。哪个gnuplot版本开始有这样的功能?我的机器安装了4.2版本,但不能使用。对于columnheader()也有相同的问题。
我想确定这是我的代码问题还是版本问题。
我打算绘制多列数据文件,使用第一列和第i列绘制xy图。因此,命令需要根据手册来工作。哪个gnuplot版本开始有这样的功能?我的机器安装了4.2版本,但不能使用。对于columnheader()也有相同的问题。
我想确定这是我的代码问题还是版本问题。
版本4.2已经拥有了columnheader
函数。
考虑数据文件data.txt
,该文件包含:
first second third fourth
1 2 3 4
2 3 4 5
3 4 5 6
set key autotitle columnheader
set style data lines
plot 'data.txt' using 1:2, '' using 1:3, '' using 1:4
从版本4.4开始,您可以在plot
命令内使用迭代:
set key autotitle columnheader
set style data lines
plot for [i=2:4] 'data.txt' using 1:i
使用 set key autotitle columnheader
可以更改图例的标题。如果标题列与 using
语句中给定的列不匹配,可以使用 title columnheader
或 title columnheader(i+1)
。 这至少适用于4.2版本。
plot for...
就已经可用了,而do for [...] {...}
则更加强大,是在4.6版本中才被引入的。 - Migueldo for
更强大,因为在这种情况下你必须使用plot for
;) - Christoph