manpagez: man pages & more
info gnuplot
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.14.2.7 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 special filenames ’+’ and ’++’ are a mechanism to allow the full range of using specifiers and plot styles with in-line 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 returned is controlled by samples. Example:

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

Similarly the pseudo-file ’++’ returns 2 columns of data forming a regular grid of [x,y] coordinates with the number of points along x controlled by samples and the number of points along y controlled by isosamples. You must set xrange and yrange before plotting ’++’. 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, and $DECK in VMS DCL. The data are entered as though they are being read from a file, one data point per record. The letter "e" at the start of the first column terminates data entry. The using option can be applied to these data—using it to filter them through a function might make sense, but selecting columns probably doesn’t!

‘’-’‘ is intended for situations where it is useful to have data and commands together, e.g., when ‘gnuplot‘ is run as a sub-process of some front-end 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 example, while

 
      plot '-' index 0, '-' index 1
      2
      4
      6

 
      10
      12
      14
      e
      2
      4
      6

 
      10
      12
      14
      e

does indeed work,

 
      plot '-', '-'
      2
      4
      6
      e
      10
      12
      14
      e

is a lot easier to type.

If you use ‘’-’‘ with replot, you may need to enter the data more than once. See replot, refresh.

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

On systems with a popen function, the datafile can be piped through a shell command by starting the file name with a ’<’. For example,

 
      pop(x) = 103*exp(-x/10)
      plot "< awk '{print $1-1965, $2}' population.dat", pop(x)

would plot the same information as the first population example but with years since 1965 as the x axis. If you want to execute this example, you have to delete all comments from the data file above or substitute the following command for the first part of the command above (the part up to the comma):

 
      plot "< awk '$0 !~ /^#/ {print $1-1965, $2}' population.dat"

While this approach is most flexible, it is possible to achieve simple filtering with the using or thru keywords.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.