Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot: for and columnheader command

I am planning to plot multiple columns data file. draw xy plot with the 1st column and the ith column. so the command for works based on the manual. which gnuplot version begin has such function? my machine install version4.2, but can not work. the same question for columnheader()
i want to make sure it is my code's issue or the version's.

like image 562
Chris Bao Avatar asked Oct 19 '14 08:10

Chris Bao


1 Answers

Version 4.2 already has the columnheader function.

Consider the data file data.txt which contains

first second third fourth
1 2 3 4
2 3 4 5
3 4 5 6

In gnuplot 4.2 you can use e.g.

set key autotitle columnheader
set style data lines
plot 'data.txt' using 1:2, '' using 1:3, '' using 1:4

Since version 4.4 you can use iterations inside the plot command:

set key autotitle columnheader
set style data lines
plot for [i=2:4] 'data.txt' using 1:i

Instead of using the set key autotitle columnheader you can also use title columnheader or title columnheader(i+1) if the title column doesn't match the column given in the using statement. This also works at least since 4.2.

like image 171
Christoph Avatar answered Oct 20 '22 04:10

Christoph