Using

The format of data within a file can be selected with the using option. An explicit scanf string can be used, or simpler column choices can be made.

Syntax:

        plot "datafile" { using { <ycol> |
                                  <xcol>:<ycol> |
                                  <xcol>:<ycol>:<ydelta> |
                                  <xcol>:<ycol>:<ylow>:<yhigh> |
                                  <xcol>:<ycol>:<ylow>:<yhigh>:<boxwidth> }
                                {"<scanf string>"} } ...

and

        splot "datafile" { using { <xcol>:<ycol>:<zcol> | <zcol> }
                                 {"<scanf string>"} } ...

<xcol>, <ycol>, and <zcol> explicitly select the columns to plot from a space or tab separated multicolumn data file. If only <ycol> is selected for plot, <xcol> defaults to 1. If only <zcol> is selected for splot, then only that column is read from the file. An <xcol> of 0 forces <ycol> to be plotted versus its coordinate number. <xcol>, <ycol>, and <zcol> can be entered as constants or expressions.

If errorbars (see also plot errorbars) are used for plots, ydelta (for example, a +/- error) should be provided as the third column, or ylow and yhigh as third and fourth columns.

If boxes or boxerrorbars are used for plots, a fifth column to specify the width of the box may be given. This implies that columns three and four must also be provided even if they are not used. If you want to plot boxes from a data file with three columns, set ylow and yhigh to y using the following command:

        plot "datafile" using 1:2:2:2:3 with boxes

Scanf strings override any <xcol>:<ycol>(:<zcol>) choices, except for ordering of input, e.g.,

        plot "datafile" using 2:1 "%f%*f%f"
causes the first column to be y and the third column to be x.

If the scanf string is omitted, the default is generated based on the <xcol>:<ycol>(:<zcol>) choices. If the using option is omitted, ''%f%f'' is used for plot (''%f%f%f%f'' for errorbars plots) and ''%f%f%f'' is used for splot.

Examples:

        plot "MyData" using "%*f%f%*20[^\n]%f" with lines

Data are read from the file ``MyData'' using the format ''%*f%f%*20[^ \n]%f''. The meaning of this format is: ''%*f'' ignore the first number, ''%f'' then read in the second and assign to x, ''%*20[^ \n]'' then ignore 20 non-newline characters, ''%f'' then read in the y value.

        n=3;
        plot "MyData", "MyData" using n

causes GNUPLOT to plot the second and third columns of MyData versus the first column. The command 'n=4; replot' would then plot the second and fourth columns of MyData versus the first column.

        splot "glass.dat" using 1

causes GNUPLOT to plot the first coordinate of the points of glass.dat as the z coordinate while ignoring the other two coordinates.

Note: GNUPLOT first reads a line of the data file into a buffer and then does a

        sscanf(input_buffer, scanf_string, &x, &y{, &z});
where 'x', 'y', and 'z' are of type 'float'. Any scanf string that specifies two (three for splot, three or four for errorbars) float numbers may be used.