Credits Overview Plotting Styles Commands Terminals

special-filenames

There are a few filenames that have a special meaning: '', '-', '+' and '++'.

The empty filename '' tells gnuplot to re-use the previous input file in the same plot command. So to plot two columns from the same input file:

      plot 'filename' using 1:2, '' using 1:3

The filename can also be reused over subsequent plot commands, however save then only records the name in a comment.

The special filenames '+' and '++' are a mechanism to allow the full range of using specifiers and plot styles with inline functions. Normally a function plot can only have a single y (or z) value associated with each sampled point. The pseudo-file '+' treats the sampled points as column 1, and allows additional column values to be specified via a using specification, just as for a true input file. The number of samples is controlled via set samples. By default samples are generated over the range given by set trange, or if trange has not been set than over the full range of set xrange.

Note: The use of trange is a change from previous gnuplot versions. It allows the sampling range to differ from the x axis range.

      plot '+' using ($1):(sin($1)):(sin($1)**2) with filledcurves

An independent sampling range can be provided immediately before the '+'. As in normal function plots, a name can be assigned to the independent variable. If given for the first plot element, the sampling range specifier has to be preceded by the sample keyword (see also plot sampling).

      plot sample [beta=0:2*pi] '+' using (sin(beta)):(cos(beta)) with lines

Additionally, the range specifier of '+' supports giving a sampling increment.

      plot $MYDATA, [t=-3:25:1] '+' using (t):(f(t))

The pseudo-file '++' returns 2 columns of data forming a regular grid of [u,v] coordinates with the number of points along u controlled by set samples and the number of points along v controlled by set isosamples. You must set urange and vrange before plotting '++'. However the x and y ranges can be autoscaled or can be explicitly set to different values than urange and vrange. Examples:

      splot '++' using 1:2:(sin($1)*sin($2)) with pm3d
      plot '++' using 1:2:(sin($1)*sin($2)) with image

The special filename '-' specifies that the data are inline; i.e., they follow the command. Only the data follow the command; plot options like filters, titles, and line styles remain on the plot command line. This is similar to << in unix shell script. The data are entered as though they were being read from a file, one data point per record. The letter "e" at the start of the first column terminates data entry.

'-' is intended for situations where it is useful to have data and commands together, e.g. when both are piped to gnuplot from another application. Some of the demos, for example, might use this feature. While plot options such as index and every are recognized, their use forces you to enter data that won't be used. For all but the simplest cases it is probably easier to first define a datablock and then read from it rather than from '-'. See datablocks.

If you use '-' with replot, you may need to enter the data more than once. See replot, refresh. Here again it may be better to use a datablock.

A blank filename ('') specifies that the previous filename should be reused. This can be useful with things like

      plot 'a/very/long/filename' using 1:2, '' using 1:3, '' using 1:4

(If you use both '-' and '' on the same plot command, you'll need to have two sets of inline data, as in the example above.)