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

3.14.2 data

Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in single or double quotes) on the ‘plot‘ command line.

Syntax:

      plot '<file_name>' {binary <binary list>}
                         {{nonuniform} matrix}
                         {index <index list> | index "<name>"}
                         {every <every list>}
                         {thru <thru expression>}
                         {using <using list>}
                         {smooth <option>}
                         {volatile} {noautoscale}

The modifiers ‘binary‘, index, every, thru, using, and smooth are discussed separately. In brief, ‘binary‘ allows data entry from a binary file (default is ASCII), index selects which data sets in a multi-data-set file are to be plotted, every specifies which points within a single data set are to be plotted, using determines how the columns within a single record are to be interpreted (thru is a special case of using), and smooth allows for simple interpolation and approximation. (‘splot‘ has a similar syntax, but does not support the smooth and thru options.)

The ‘volatile‘ keyword indicates that the contents of the data file may be different if the file is re-read. This tells the program to use refresh rather than replot commands whenever possible. See refresh.

The ‘noautoscale‘ keyword means that the points making up this plot will be ignored when automatically determining axis range limits.

ASCII DATA FILES:

Data files should contain at least one data point per record (using can select one data point from the record). Records beginning with ‘#‘ (and also with ‘!‘ on VMS) will be treated as comments and ignored. Each data point represents an (x,y) pair. For ‘plot‘s with error bars or error bars with lines (see errorbars or errorlines), each data point is (x,y,ydelta), (x,y,ylow,yhigh), (x,y,xdelta), (x,y,xlow,xhigh), or (x,y,xlow,xhigh,ylow,yhigh).

In all cases, the numbers of each record of a data file must be separated by white space (one or more blanks or tabs) unless a format specifier is provided by the using option. This white space divides each record into columns. However, whitespace inside a pair of double quotes is ignored when counting columns, so the following datafile line has three columns:

      1.0 "second column" 3.0

Data may be written in exponential format with the exponent preceded by the letter e or E. The fortran exponential specifiers d, D, q, and Q may also be used if the command ‘set datafile fortran‘ is in effect.

Only one column (the y value) need be provided. If x is omitted, ‘gnuplot‘ provides integer values starting at 0.

In datafiles, blank records (records with no characters other than blanks and a newline and/or carriage return) are significant.

Single blank records designate discontinuities in a ‘plot‘; no line will join points separated by a blank records (if they are plotted with a line style).

Two blank records in a row indicate a break between separate data sets. See index.

If autoscaling has been enabled (autoscale), the axes are automatically extended to include all datapoints, with a whole number of tic marks if tics are being drawn. This has two consequences: i) For ‘splot‘, the corner of the surface may not coincide with the corner of the base. In this case, no vertical line is drawn. ii) When plotting data with the same x range on a dual-axis graph, the x coordinates may not coincide if the x2tics are not being drawn. This is because the x axis has been autoextended to a whole number of tics, but the x2 axis has not. The following example illustrates the problem:

      reset; plot '-', '-' axes x2y1
      1 1
      19 19
      e
      1 1
      19 19
      e

To avoid this, you can use the ‘fixmin‘/‘fixmax‘ feature of the autoscale command, which turns off the automatic extension of the axis range upto the next tic mark.

Label coordinates and text can also be read from a data file (see labels).

BINARY DATA FILES:

Gnuplot can read binary data files. However, adequate information about details of the file format must be given on the command line or extracted from the file itself for a supported binary filetype. In particular, there are two structures for binary files, a matrix binary format and a general binary format.

The matrix binary format contains a two dimensional array of 32 bit IEEE float values with an additional column and row of coordinate values. As with ASCII matrix, in the using list, repetition of the coordinate row constitutes column 1, repetition of the coordinate column constitutes column 2, and the array of values constitutes column 3.

The general binary format contains an arbitrary number of columns for which information must be specified at the command line. For example, array, record, ‘format‘ and using can indicate the size, format and dimension of data. There are a variety of useful commands for skipping file headers and changing endianess. There are a set of commands for positioning and translating data since often coordinates are not part of the file when uniform sampling is inherent in the data. Different from matrix binary or ASCII, general binary does not treat the generated columns as 1, 2 or 3 in the using list. Rather, column 1 begins with column 1 of the file, or as specified in the ‘format‘ list.

There are global default settings for the various binary options which may be set using the same syntax as the options when used as part of the ‘(s)plot <filename> binary ...‘ command. This syntax is ‘set datafile binary ...‘. The general rule is that common command-line specified parameters override file-extracted parameters which override default parameters.

Matrix binary is the default binary format when no keywords specific to general binary are given, i.e., array, record, ‘format‘, filetype.

General binary data can be entered at the command line via the special file name ’-’. However, this is intended for use through a pipe where programs can exchange binary data, not for keyboards. There is no "end of record" character for binary data. Gnuplot continues reading from a pipe until it has read the number of points declared in the array qualifier.

See ‘datafile binary‘ for more details.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November 19, 2011 using texi2html 5.0.