1
votes

(Currently using gnuplot version 4.6.3)

I am plotting from several datafiles (dataA, dataB, dataC, etc..) where the data is broken up into datablocks (with single lines separating them) and prepended by some text:

testing A001
#A       B       C
-100    -91     -90
-95     -88     -88
-90     -84     -83
-85     -79     -79 

testing A002
#A       B       C
-100    -91     -90
-95     -88     -88
-90     -84     -83
-85     -79     -79 

... etc. 

Edit: I apologize if my explanation below is a little confusing - I essentially want to do what this guy also wants to do: http://gnuplot.10905.n7.nabble.com/Using-title-columnheader-td3900.html (However the solution posted in response did not work for me and I also don't quite understand it)

I am currently using "do" iterations to plot each datablock of all datafiles simultaneously on a single graph. However, I'm having trouble with the "set autotitle" command - it only takes, in this example, "A001", "B001",etc. and uses it as the title of every single graph so that plots of subsequent datablocks are also labelled "A001", "B001", etc. whereas I would like to have the graphs labelled "A001", "A002", .. "B001", "B002", etc.

This is my current plot command:

do for [i=0:25] {
plotfile = "RESULT".i.".png"
set output plotfile
set key autotitle columnhead
plot "dataA.dat" every ::0:i:4:i using 1:2 with lines title columnhead(2), plot "dataB.dat" every ::0:i:4:i using ... etc.
}

Any help/hints are appreciated!!

1

1 Answers

2
votes

An example from the link you give works this way. You need two empty lines between blocks.

i=1
plot "-" using 1:2:-2 index i title columnheader
testing A001
#A       B       C
-100    -91     -90
-95     -88     -88
-90     -84     -83
-85     -79     -79 


testing A002
#A       B       C
-100    -91     -90
-95     -88     -88
-90     -84     -83
-85     -79     -79
EOF