next up previous contents index
Next: Using_examples Up: Data Previous: Thru   Contents   Index


Using

The most common datafile modifier is using.

Syntax:

     plot 'file' using {<entry> {:<entry> {:<entry> ...}}} {'format'}

If a format is specified, each datafile record is read using the C library's 'scanf' function, with the specified format string. Otherwise the record is read and broken into columns. By default the separation between columns is whitespace (spaces and/or tabs), but see datafile separator (p. [*]).

Each 4#4entry5#5 may be a simple column number that selects the value from one field of the input fit, an expression enclosed in parentheses, or empty.

If the entry is an expression in parentheses, then the function column(N) may be used to indicate the value in column N. That is, column(1) refers to the first item read, column(2) to the second, and so on. The special symbols $1, $2, ... are shorthand for column(1), column(2) ... The function valid(N) tests whether the value in the Nth column is a valid number.

In addition to the actual columns 1...N in the input data file, gnuplot presents data from several "pseudo-columns" that hold bookkeeping information. E.g. $0 or column(0) returns the sequence number of this data record within a dataset.

An empty 4#4entry5#5 will default to its order in the list of entries. For example, using ::4 is interpreted as using 1:2:4.

If the using list has but a single entry, that 4#4entry5#5 will be used for y and the data point number (pseudo-column $0) is used for x; for example, "plot 'file' using 1" is identical to "plot 'file' using 0:1". If the using list has two entries, these will be used for x and y. See set style (p. [*]) and fit (p. [*]) for details about plotting styles that make use of data from additional columns of input.

'scanf' accepts several numerical specifications but gnuplot requires all inputs to be double-precision floating-point variables, so "%lf" is essentially the only permissible specifier. A format string given by the user must contain at least one such input specifier, and no more than seven of them. 'scanf' expects to see white space -- a blank, tab ("2#2t"), newline ("2#2n"), or formfeed ("2#2f") -- between numbers; anything else in the input stream must be explicitly skipped.

Note that the use of "2#2t", "2#2n", or "2#2f" requires use of double-quotes rather than single-quotes.


Subsections
next up previous contents index
Next: Using_examples Up: Data Previous: Thru   Contents   Index
2011-08-04