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 or by giving an explicit sampling interval in the range specifier. Samples are generated over the range given by set trange if it has been set, otherwise over the full range of set xrange.

Note: The use of trange is a change from some earlier 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. Here is an example where the sampling interval (1.5) is given as part of the sampling range. Samples will be generated at -3, -1.5, 0, 1.5, ..., 24.

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

A sampling range that immediately follows the plot or splot command might be mistakenly parsed as an x-axis range. To prevent this ambiguity you can either precede it with the sample keyword or provide a sampling interval, possibly empty to use the default, as a third field of the sampling range. See the example of such ambiguity in plot sampling.

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

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 provide two sets of inline data. It will not reuse the first one.