Syntax

The general rules of syntax and punctuation in gnuplot are that keywords and options are order-dependent. Options and any accompanying parameters are separated by spaces whereas lists and co-ordinates are separated by commas. Ranges are separated by colons and enclosed in braces [], text and file names are enclosed in quotes, and a few miscellaneous things are enclosed in parentheses. Brackets {} are used for a few special purposes.

Commas are used to separate co-ordinates (see set co-ordinates); the list of variables being fitted (the list after the via keyword on the fit command); lists of discrete contours or the loop parameters which specify them (see set cntrparam); the arguments of the set commands dgrid3d, dummy, isosamples, offsets, origin, samples, size, time, and view; lists of tics or the loop parameters which specify them; the offsets for titles and axis labels; parametric functions to be used to calculate the x, y, and z co-ordinates on the s/plot commands; and the complete sets of keywords specifying individual data sets or functions on s/plot commands.

Parentheses are used to delimit sets of explicit tics (as opposed to loop parameters) and to indicate computations in the using filter of the fit and s/plot commands.

(Parentheses and commas are also used as usual in function notation.)

Braces are used to delimit ranges, whether they are given in set commands or on s/plot commands.

Colons are used to separate extrema in range specifications and to separate columns in the using filter of the s/plot and fit commands.

Semicolons are used to separate commands given on a single line.

Brackets are used in text to be specially processed by some terminals, like enhpost. They are also used to denote complex numbers: {3,2} = 3 + 2i.

Text may be enclosed in single- or double-quotes. Backslash processing of sequences like \n (newline) is performed for double-quoted strings, but not for single-quoted strings. The justification is the same for each line of a multi-line string. Thus the center-justified string

       "This is the first line of text.\nThis is the second line."

will produce

        This is the first line of text.
           This is the second line.

but

       'This is the first line of text.\nThis is the second line.'

will produce

        This is the first line of text.\nThis is the second line.

Both single- and double-quoted strings process \nnn correctly.

The EEPIC, Imagen, Uniplex, LaTeX, and TPIC drivers allow \ \ in a string to specify a newline.