Search code examples
shellplotgnuplotpostscript

Plotting multiple files to single ps file in different pages using gnuplot


I have folders 10,11,12,...50. In all the folders I have data files "data.dat". I want to plot data from all these files in to a single ps file. Each file gets a page of their own. Like:

plot "10/data.dat" u 1:3 w l, "10/data.dat" u 1:4 w l, "10/data.dat" u 1:5 w l

plot "11/data.dat" u 1:3 w l, "11/data.dat" u 1:4 w l, "11/data.dat" u 1:5 w l

.....

plot "50/data.dat" u 1:3 w l, "50/data.dat" u 1:4 w l, "50/data.dat" u 1:5 w l

So each file gets their own page and the ps file will have 41 pages. How do I do that using some kind of loop structure in gnuplot? Or how should I use shell script?


Solution

  • You should use a do for since a plot for would plot all of them in a single page.

    do for [i=10:41] {
        set title "Plot ".i
        plot "".i."/data.dat" u 1:3 w l, "" u 1:4 w l, "" u 1:5 w l
    }