Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## data

Data provided in a file can be plotted by giving the name of the file (enclosed in single or double quotes) on the plot command line. Data may also come from an input stream that is not a file. See special-filenames, piped-data, datablocks.

Syntax:

          plot '<file_name>' {binary <binary list>}
                             {{nonuniform|sparse} matrix}
                             {index <index list> | index "<name>"}
                             {every <every list>}
                             {skip <number-of-lines>}
                             {using <using list>}
                             {convexhull} {concavehull}
                             {smooth <option>}
                             {bins <options>}
                             {mask}
                             {volatile} {zsort} {noautoscale}

The modifiers binary, index, every, skip, using, smooth, bins, mask, convexhull, concavehull, and zsort are discussed separately. In brief

- skip N tells the program to ignore N lines at the start of the input file
- binary indicates that the file contains binary data rather than text
- 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 specifies which columns in the file are to be used in which order
- smooth performs simple filtering, interpolation, or curve-fitting of the data prior to plotting
- convexhull either alone or in combination with smooth replaces the points in the input data set with a new set of points that constitute the vertices of a bounding polygon.
- bins sorts individual input points into equal-sized intervals along x and plots a single accumulated value per interval
- mask filters the data through a previously defined mask to plot only a selected subset of pixels in an image or a selected region of a pm3d surface.
- volatile indicates that the content of the file may not be available to reread later and therefore it should be retained internally for re-use.

splot has a similar syntax but does not support bins and supports only a few smooth options.

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

TEXT DATA FILES:

Each non-empty line in a data file describes one data point, except that records beginning with # will be treated as comments and ignored.

Depending on the plot style and options selected, from one to eight values are read from each line and associated with a single data point. See using.

The individual records on a single line of data must be separated by white space (one or more blanks or tabs) or a special field separator character which is specified by the set datafile command. A single field may itself contain white space characters if the entire field is enclosed in a pair of double quotes, or if a field separator other than white space is in effect. 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.

Blank records in a data file 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 (set 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 noextend modifier of the set autoscale or set [axis]range commands. This turns off extension of the axis range to include the next tic mark.

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

Subtopics

- columnheaders
- csv files
- every
- example datafile
- filters

- index
- skip
- smooth
- special-filenames
- piped-data

- using
- volatile