Suppose the file "looper" contains the commands
a=a+1 plot sin(x*a) pause -1 if(a<5) rereadand from within gnuplot you submit the commands
a=0 load 'looper'The result will be five plots (separated by the pause message).
Suppose the file "data" contains six columns of numbers with a total yrange from 0 to 10; the first is x and the next are five different functions of x. Suppose also that the file "plotter" contains the commands
c_p = c_p+1 plot "$0" using 1:c_p with lines linetype c_p if(c_p < n_p) rereadand from within gnuplot you submit the commands
n_p=6 c_p=1 unset key set yrange [0:10] set multiplot call 'plotter' 'data' unset multiplotThe result is a single graph consisting of five plots. The yrange must be set explicitly to guarantee that the five separate graphs (drawn on top of each other in multiplot mode) will have exactly the same axes. The linetype must be specified; otherwise all the plots would be drawn with the same type. See animate.dem in demo directory for an animated example.
Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
Distributed under the gnuplot license (rights to distribute modified versions are withheld).