Go to the first, previous, next, last section, table of contents.

reread

The reread command causes the current gnuplot command file, as specified by a load command or on the command line, to be reset to its starting point before further commands are read from it. This essentially implements an endless loop of the commands from the beginning of the command file to the reread command. (But this is not necessarily a disaster---reread can be very useful when used in conjunction with if. See if for details.) The reread command has no effect if input from standard input.

Examples:

Suppose the file "looper" contains the commands

     a=a+1
     plot sin(x*a)
     pause -1
     if(a<5) reread

and from within gnuplot you submit the commands

     a=0
     load 'looper'

The result will be four 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) reread

and from within gnuplot you submit the commands

     n_p=6
     c_p=1
     set nokey
     set yrange [0:10]
     set multiplot
     call 'plotter' 'data'
     set nomultiplot

The 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.


Go to the first, previous, next, last section, table of contents.