1

(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 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

2 Comments

I've tried replacing all newlines with double newlines but I'm getting an error. I suspect it's because I'm also using the "every" command which relies on datablocks to be separated by single lines. Has anybody ever tried to combine that command with the "every" command?
*** Tried taking out the "every" command and turns out it was redundant in this case. Huh. I guess I got lucky.. thanks for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.