I think I understand from the behavior how these two plot commands are different, but I really don't understand why they are different. That is, I did not expect that there would be a difference. These two cases:
plot for [i=0:3] 'ctg-y2.dat' index i using 2 title columnheader(2) with lines
and
plot 'ctg-y2.dat' index 0:3 using 2 title columnheader(2) with lines
(example data file http://gnuplot.cvs.sourceforge.net/viewvc/gnuplot/gnuplot/demo/ctg-y2.dat )
The first one does what I expect: for each of the four data sets in the file, read the column header from the first row of the data set and build the remaining data. The second does something completely different: it does not read the column heading for any data set, but the first, and it seems that it displays all the data as if they were part of a single data set. The result is a mess, since the implicit x values do not match correctly.
The index description in the manual does not mention this use of the range with the index, as far as I can tell. Is this documented somewhere? This is mistake? Am I doing something stupid?
source share