\input{titlepage.tex}
\section{Gnuplot}
GNUPLOT is a command-driven interactive function plotting program. It
is case sensitive (commands and function names written in lowercase
are not the same as those written in CAPS). All command names may be
abbreviated, as long as the abbreviation is not ambiguous. Any number
of commands may appear on a line, separated by semicolons (;).
Strings are indicated with quotes.  They may be either single or double
quotation marks, e.g.,

\begin{verbatim}
         load "filename"
         cd 'dir'
\end{verbatim}

Any command-line arguments are assumed to be names of files containing 
GNUPLOT commands, with the exception of standard X11 arguments, which
are processed first. Each file is loaded with the {\bf load} command, in the
order specified. GNUPLOT exits after the last file is processed.  When
no load files are named, gnuplot enters into an interactive mode.

Commands may extend over several input lines, by ending each 
line but the last with a backslash ($\backslash$). The backslash must be the LAST
character on each line. The effect is as if the backslash and newline
were not there. That is, no white space is implied, nor is a comment
terminated. Therefore, commenting out a continued line comments out
the entire command (see {\bf comment}).

In this documentation, curly braces (\{\}) denote optional arguments to
many commands, and a vertical bar ($|$) separates mutually exclusive
choices.  GNUPLOT keywords or help topics are indicated by backquotes
or {\bf boldface} (where available).  Angle brackets ($<$$>$) are used to mark
replaceable tokens.

For help on any topic, type {\bf help} followed by the name of the topic.

The new GNUPLOT user should begin by reading about the {\bf plot}
command (type {\bf help plot}).
\section{Cd}
The {\bf cd} command changes the working directory.

Syntax:
\begin{verbatim}
        cd "<directory-name>"
\end{verbatim}

The directory name must be enclosed in quotes.

Examples:
\begin{verbatim}
        cd 'subdir'
        cd ".."
\end{verbatim}
\section{Clear}
The {\bf clear} command erases the current screen or output device as
specified by {\bf set output}. This usually generates a formfeed on
hardcopy devices. Use {\bf set terminal} to set the device type.
\section{Command-line editing}
The Unix and IBM PC versions of GNUPLOT support command-line editing.
Also, a history mechanism allows previous commands to be edited, and
re-executed. After the command line has been edited, a newline or
carriage return will enter the entire line regardless of where the
cursor is positioned.

The editing commands are as follows:


\begin{center}
\begin{tabular}{|ccl|} \hline
Character && Function \\ \hline 
\multicolumn{3}{|c|}{Line Editing}\\
\verb~^B~ && move back a single character.\\
\verb~^F~ && move forward a single character.\\
\verb~^A~ && move to the beginning of the line.\\
\verb~^E~ && move to the end of the line.\\
\verb~^H, DEL~ && delete the previous character.\\
\verb~^D~ && delete the current character.\\
\verb~^K~ && delete from current position to the end of line.\\
\verb~^L, ^R~ && redraw line in case it gets trashed.\\
\verb~^U~ && delete the entire line. \\
\verb~^W~ && delete from the current word to the end of line. \\ \hline
\multicolumn{3}{|c|}{History} \\
\verb~^P~ && move back through history.\\
\verb~^N~ && move forward through history.\\
\hline
\end{tabular}
\end{center}

On the IBM PC the use of a TSR program such as DOSEDIT or CED may be
desired for line editing. For such a case GNUPLOT may be compiled with
no line editing capability (default makefile setup). Set READLINE in the
makefile and add readline.obj to the link file if GNUPLOT line editing
is to be used for the IBM PC. The following arrow keys may be used
on the IBM PC version if readline is used:


\begin{center}
\begin{tabular}{|ccl|} \hline
Arrow key & Function & \\ \hline 
Left      & same as \verb~^B~. & \\
Right     & same as \verb~^F~. & \\
Ctl Left  & same as \verb~^A~. & \\
Ctl Right & same as \verb~^E~. & \\
Up        & same as \verb~^P~. & \\
Down      & same as \verb~^N~. & \\
\hline
\end{tabular}
\end{center}
(The readline function in gnuplot is not the same as the readline used
in GNU BASH and GNU EMACS.  It is somewhat compatible however.) 
\section{Comment}
Comments are supported as follows: a \# may appear in most places in a line
and GNUPLOT will ignore the rest of the line. It will not have this
effect inside quotes, inside numbers (including complex numbers), inside
command substitutions, etc. In short, it works anywhere it makes sense
to work.
\section{Environment}
A number of shell environment variables are understood by GNUPLOT.
None of these are required, but may be useful.

If GNUTERM is defined, it is used as the name of the terminal type to
be used. This overrides any terminal type sensed by GNUPLOT on start
up, but is itself overridden by the .gnuplot (or equivalent) start-up
file (see {\bf start-up}), and of course by later explicit changes.

On Unix, AmigaDOS, and MS-DOS, GNUHELP may be defined to be the pathname
of the HELP file (gnuplot.gih).

On VMS, the symbol GNUPLOT\$HELP should be defined as the name of 
the help library for GNUPLOT.

On Unix, HOME is used as the name of a directory to search for 
a .gnuplot file if none is found in the current directory.
On AmigaDOS and MS-DOS, GNUPLOT is used. On VMS, SYS\$LOGIN: is used.
See help start-up.

On Unix, PAGER is used as an output filter for help messages.

On Unix and AmigaDOS, SHELL is used for the {\bf shell} command. On MS-DOS,
COMSPEC is used for the {\bf shell} command.

On AmigaDOS, GNUFONT is used for the screen font.  For example:
``setenv GNUFONT sapphire/14''.

On MS-DOS, if the BGI interface is used, the variable {\bf BGI} is used to point 
to the full path to the BGI drivers directory. Furthermore SVGA is used to
name the Super VGA BGI driver in 800x600 res., and its mode of operation
as 'Name.Mode'.
For example, if the Super VGA driver is C:$\backslash$TC$\backslash$BGI$\backslash$SVGADRV.BGI and mode 3 is
used for 800x600 res., then: 'set BGI=C:$\backslash$TC$\backslash$BGI' and 'set SVGA=SVGADRV.3'.
\section{Exit}
The commands {\bf exit} and {\bf quit} and the END-OF-FILE character
will exit GNUPLOT. All these commands will clear the output device
(as the {\bf clear} command does) before exiting.
\section{Expressions}
In general, any mathematical expression accepted by C, FORTRAN,
Pascal, or BASIC is valid. The precedence of these operators is
determined by the specifications of the C programming language.
White space (spaces and tabs) is ignored inside expressions.

Complex constants may be expressed as the \{$<$real$>$,$<$imag$>$\}, where $<$real$>$
and $<$imag$>$ must be numerical constants. For example, \{3,2\}
represents 3 + 2i; \{0,1\} represents {\bf i} itself. The curly braces 
are explicitly required here.
\subsection{Functions}
The functions in GNUPLOT are the same as the corresponding functions
in the Unix math library, except that all functions accept integer,
real, and complex arguments, unless otherwise noted. The {\bf sgn}
function is also supported, as in BASIC.

\begin{center}
\begin{tabular}{|ccl|} \hline
Function & Arguments & Returns \\ \hline
abs(x) & any  &  absolute value of {\tt x}, $|x|$; same type \\
abs(x) & complex &  length of {\tt x}, $\sqrt{{\mbox{real}(x)^{2} +
\mbox{imag}(x)^{2}}}$ \\
acos(x) & any  & $\cos^{-1} x$ (inverse cosine) in radians \\
arg(x) & complex & the phase of $x$ in radians\\
asin(x) & any  & $\sin^{-1} x$ (inverse sin) in radians \\
atan(x) & any  & $\tan^{-1} x$ (inverse tangent) in radians \\
besj0(x) & radians &  $j_{0}$ Bessel function of $x$ \\
besj1(x) & radians & $j_{1}$ Bessel function of $x$ \\
besy0(x) & radians & $y_{0}$ Bessel function of $x$ \\
besy1(x) & radians & $y_{1}$ Bessel function of $x$ \\
ceil(x) & any & $\lceil x \rceil$, smallest integer not less than $x$
(real part) \\
cos(x) & radians & $\cos x$, cosine of $x$ \\
cosh(x) & radians & $\cosh x$, hyperbolic cosine of $x$ \\
exp(x) & any & $e^{x}$,  exponential function of $x$ \\
floor(x) & any & $\lfloor x \rfloor$,  largest integer not greater
than $x$ (real part) \\
gamma(x) & any & $\Gamma(\mbox{real}(x))$,  gamma function of real($x$) \\
imag(x) & complex &  imaginary part of $x$ as a real number \\
int(x) & real &  integer part of $x$, truncated toward zero \\
log(x) & any & $\log_{e} x$,  natural logarithm (base $e$) of $x$ \\
log10(x) & any & $\log_{10} x$,  logarithm (base $10$) of $x$ \\
real(x) & any &  real part of $x$ \\
sgn(x) & any & 1 if $x>0$, -1 if $x<0$, 0 if $x=0$. imag($x$) ignored \\
sin(x) & radians & $\sin x$, sine of $x$ \\
sinh(x) & radians & $\sinh x$, hyperbolic sine $x$ \\
sqrt(x) & any & $\sqrt{x}$,  square root of $x$ \\
tan(x) & radians & $\tan x$,  tangent of $x$ \\
tanh(x) & radians & $\tanh x$, hyperbolic tangent of $x$\\
\hline
\end{tabular}
\end{center}
\subsection{Operators}
The operators in GNUPLOT are the same as the corresponding operators
in the C programming language, except that all operators accept
integer, real, and complex arguments, unless otherwise noted.
The ** operator (exponentiation) is supported, as in FORTRAN.

Parentheses may be used to change order of evaluation.
\subsubsection{Binary}
The following is a list of all the binary operators and their
usages:


\begin{center}
\begin{tabular}{|ccl|} \hline
\multicolumn{3}{|c|}{Binary Operators} \\
Symbol & Example & Explanation \\ \hline
\verb~**~ & \verb~a**b~ & exponentiation\\
\verb~*~ & \verb~a*b~ & multiplication\\
\verb~/~ & \verb~a/b~ & division\\
\verb~%~ & \verb~a%b~ & * modulo\\
\verb~+~ & \verb~a+b~ & addition\\
\verb~-~ & \verb~a-b~ & subtraction\\
\verb~==~ & \verb~a==b~ & equality\\
\verb~!=~ & \verb~a!=b~ & inequality\\
\verb~&~ & \verb~a&b~ & * bitwise AND\\
\verb~^~ & \verb~a^b~ & * bitwise exclusive OR\\
\verb~|~ & \verb~a|b~ & * bitwise inclusive OR\\
\verb~&&~ & \verb~a&&b~ & * logical AND\\
\verb~||~ & \verb~a||b~ & * logical OR\\
\verb~?:~ & \verb~a?b:c~ & * ternary operation\\
\hline
\end{tabular}
\end{center}
(*) Starred explanations indicate that the operator requires
integer arguments.

Logical AND (\&\&) and OR ($|$$|$) short-circuit the way they do in C.
That is, the second \&\& operand is not evaluated if the first is
false; the second $|$$|$ operand is not evaluated if the first is true.

The ternary operator evaluates its first argument (a). If it is
true (non-zero) the second argument (b) is evaluated and returned,
otherwise the third argument (c) is evaluated and returned.
\subsubsection{Unary}
The following is a list of all the unary operators and their
usages:


\begin{center}
\begin{tabular}{|ccl|} \hline
\multicolumn{3}{|c|}{Unary Operators}\\
Symbol & Example & Explanation \\ \hline
\verb@-@ & \verb@-a@ & unary minus \\
\verb@~@ & \verb@~a@ & * one's complement \\
\verb@!@ & \verb@!a@ & * logical negation \\
\verb@!@ & \verb@a!@ & * factorial \\
\hline
\end{tabular}
\end{center}
(*) Starred explanations indicate that the operator requires an
integer argument.

The factorial operator returns a real number to allow a greater range.
\section{Help}
The {\bf help} command displays on-line help. To specify information on a
particular topic use the syntax:

\begin{verbatim}
        help {<topic>}
\end{verbatim}

If $<$topic$>$ is not specified, a short message is printed about
GNUPLOT. After help for the requested topic is given, help for a
subtopic may be requested by typing its name, extending the help
request. After that subtopic has been printed, the request may be
extended again, or simply pressing return goes back one level to the
previous topic. Eventually, the GNUPLOT command line will return.
\section{Load}
The {\bf load} command executes each line of the specified input file as
if it had been typed in interactively. Files created by the {\bf save}
command can later be {\bf load}ed. Any text file containing valid
commands can be created and then executed by the {\bf load} command.
Files being {\bf load}ed may themselves contain {\bf load} commands. See
{\bf comment} for information about comments in commands.

The {\bf load} command must be the last command on the line.

Syntax:
\begin{verbatim}
        load "<input-file>"
\end{verbatim}

The name of the input file must be enclosed in quotes.

Examples:

\begin{verbatim}
        load 'work.gnu'
        load "func.dat"
\end{verbatim}

The {\bf load} command is performed implicitly on any file names given as
arguments to GNUPLOT. These are loaded in the order specified, and
then GNUPLOT exits.
\section{Pause}
The {\bf pause} command displays any text associated with the command and
then waits a specified amount of time or until the carriage return is
pressed.  {\bf pause} is especially useful in conjunction with {\bf load} files.

Syntax:
\begin{verbatim}
        pause <time> {"<string>"}
\end{verbatim}

$<$time$>$ may be any integer constant or expression. Choosing -1 will
wait until a carriage return is hit, zero (0) won't pause at all, and
a positive integer will wait the specified number of seconds.

Note: Since {\bf pause} is not part of the plot it may interact with
different device drivers differently (depending upon how text and
graphics are mixed).

Examples:
\begin{verbatim}
        pause -1    # Wait until a carriage return is hit
        pause 3     # Wait three seconds
        pause -1  "Hit return to continue"
        pause 10  "Isn't this pretty?  It's a cubic-spline."
\end{verbatim}

\section{Plot}
{\bf plot} and {\bf splot} are the primary commands of the program. They plot
functions and data in many, many ways. {\bf plot} is used to plot 2-d
functions and data, while {\bf splot} plots 3-d surfaces and data.

Syntax:

\begin{verbatim}
        plot {ranges}  <function> {title} {style}
                    {, <function> {title} {style}...}
\end{verbatim}

\begin{verbatim}
        splot {ranges}  <function> {title} {style}
                     {, <function> {title} {style}...}
\end{verbatim}

where $<$function$>$ is either a mathematical expression, the name of a
data file enclosed in quotes, or a pair ({\bf plot}) or triple ({\bf splot})
of mathematical expressions in the case of parametric functions.
User-defined functions and variables may also be defined here.

{\bf plot} and {\bf splot} commands can be as simple as

\begin{verbatim}
        plot sin(x)
\end{verbatim}

and

\begin{verbatim}
        splot x * y
\end{verbatim}

or as complex as (!)

\begin{verbatim}
        plot [t=1:10] [-pi:pi*2] tan(t),"data.1" with lines,t**2 with points
\end{verbatim}
\subsection{Data-file}
Discrete data contained in a file can displayed by specifying the
name of the data file (enclosed in quotes) on the {\bf plot} or {\bf splot}
command line. Data files should contain one data point per line.
Lines beginning with \# (or ! on VMS) will be treated as comments
and ignored. For {\bf plot}s, each data point represents an (x,y)
pair. For {\bf splot}s, each point is an (x,y,z) triple. For {\bf plot}s with
error bars (see {\bf plot errorbars}), each data point is either
(x,y,ydelta) or (x,y,ylow,yhigh). In all cases, the numbers on each
line of a data file must be separated by blank space. This blank
space divides each line into columns.

For {\bf plot}s the x value may be omitted, and for {\bf splot}s the x
and y values may be omitted. In either case the omitted values are
assigned the current coordinate number. Coordinate numbers start at 0
and are incremented for each data point read.

To specify other formats, see {\bf plot datafile using}.

In the {\bf plot} command, blank lines in the data file cause a break in
the plot. There will be no line drawn between the preceding and
following points if the plot style is {\bf lines} or {\bf linespoints} (see
{\bf plot style}). This does not change the plot style, as would plotting
the data as separate curves.

This example compares the data in the file population.dat to a
theoretical curve:

\begin{verbatim}
        pop(x) = 103*exp((1965-x)/10)
        plot [1960:1990] 'population.dat', pop(x)
\end{verbatim}

The file population.dat might contain:

\begin{verbatim}
        # Gnu population in Antarctica since 1965
        1965   103
        1970   55
        1975   34
        1980   24
        1985   10
\end{verbatim}

When a data file is plotted, {\bf samples} and {\bf iso\_samples} are ignored.
Curves plotted using the {\bf plot} command are automatically extended to
hold the entire curve. Similarly grid data plotted using the {\bf splot}
command is automatically extended, using the assumption that isolines
are separated by blank lines (a line with only a CR/LF in it).

Implicitly, there are two types of 3-d datafiles. If all the isolines
are of the same length, the data is assumed to be a grid data, i.e.,
the data has a grid topology. Cross isolines in the other parametric
direction (the ith cross isoline passes thru the ith point of all the
provided isolines) will also be drawn for grid data. (Note contouring
is available for grid data only.) If all the isolines are not of the
same length, no cross isolines will be drawn and contouring that data
is impossible.

For splot if 3-d datafile and using format (see {\bf splot datafile using})
specify only z (height field), a non parametric mode must be specified.
If, on the other hand, x, y, and z are all specified, a parametric
mode should be selected (see {\bf set parametric}) since data is defining a
parametric surface.

A simple example of plotting a 3-d data file is

\begin{verbatim}
        set parametric
        splot 'glass.dat'
\end{verbatim}

or

\begin{verbatim}
        set noparametric
        splot 'datafile.dat'
\end{verbatim}

where the file datafile.dat might contain:

\begin{verbatim}
        # The valley of the Gnu.
        10
        10
        10
\end{verbatim}

\begin{verbatim}
        10
        5
        10
\end{verbatim}

\begin{verbatim}
        10
        1
        10
\end{verbatim}

\begin{verbatim}
        10
        0
        10
\end{verbatim}

Note datafile.dat defines a 4 by 3 grid ( 4 rows of 3 points each ).
Rows are separated by blank lines.

On some computer systems with a popen function (UNIX), the datafile
can be piped through a shell command by starting the file name
with a '$<$'.  For example:

\begin{verbatim}
        pop(x) = 103*exp(x/10)
        plot '< awk "{print $1-1965 $2}" population.dat', pop(x)
\end{verbatim}

would plot the same information as the first population example
but with years since 1965 as the x axis.

For more information about 3-d plotting, see {\bf splot}.
\subsubsection{Using}
The format of data within a file can be selected with the {\bf using} 
option. An explicit scanf string can be used, or simpler column
choices can be made.

Syntax:

\begin{verbatim}
        plot "datafile" { using { <ycol> |
                                  <xcol>:<ycol> |
                                  <xcol>:<ycol>:<ydelta> |
                                  <xcol>:<ycol>:<ylow>:<yhigh> }
                                {"<scanf string>"} } ...
\end{verbatim}

and

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

$<$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 {\bf plot}, $<$xcol$>$ defaults to 1. If only $<$zcol$>$ is selected
for {\bf 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 {\bf plot errorbars}) are used for {\bf plot}s,
ydelta (for example, a +/- error) should be provided as the third
column, or ylow and yhigh as third and fourth columns.  These columns
must follow the x and y columns.

Scanf strings override any $<$xcol$>$:$<$ycol$>$(:$<$zcol$>$) choices, except for
ordering of input, e.g.,
\begin{verbatim}
        plot "datafile" using 2:1 "%f%*f%f"
\end{verbatim}
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 {\bf using} option is omitted, ''\%f\%f''
is used for {\bf plot} (''\%f\%f\%f\%f'' for {\bf errorbar} {\bf plot}s) and ''\%f\%f\%f'' is
used for {\bf splot}.

Examples:

\begin{verbatim}
        plot "MyData" using "%*f%f%*20[^\n]%f" with lines
\end{verbatim}

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

\begin{verbatim}
        n=3;
        plot "MyData", "MyData" using n 
\end{verbatim}

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.

\begin{verbatim}
        splot "glass.dat" using 1
\end{verbatim}

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 
\begin{verbatim}
        sscanf(input_buffer, scanf_string, &x, &y{, &z});
\end{verbatim}
where 'x', 'y', and 'z' are of type 'float'. Any scanf string that
specifies two (three for {\bf splot}, three or four for {\bf errorbars}) float
numbers may be used.
\subsection{Errorbars}
Error bars are supported for 2-d data file plots by reading one or
two additional columns specifying ydelta or ylow and yhigh
respectively. No support exists for x error bars or any error bars
for {\bf splot}s.

In the default situation, GNUPLOT expects to see three or four
numbers on each line of the data file, either (x, y, ydelta) or 
(x, y, ylow, yhigh). The x coordinate must be specified. The order
of the numbers must be exactly as given above. Data files in this
format can easily be plotted with error bars:

\begin{verbatim}
        plot "data.dat" with errorbars
\end{verbatim}

The error bar is a vertical line plotted from (x, ylow) to (x,
yhigh). If ydelta is specified instead of ylow and yhigh, 
ylow=y-ydelta and yhigh=y+ydelta are derived. If there
are only two numbers on the line, yhigh and ylow are both set to
y. To get lines plotted between the data points, {\bf plot} the
data file twice, once with errorbars and once with lines.

If y autoscaling is on, the y range will be adjusted to fit the
error bars.

The {\bf using} option may be used to specify how columns of the data file
are to be assigned to x, y, ydelta, ylow, and yhigh. The x column must
be provided and both the x and y columns must appear before the
errorbar columns. If three column numbers are given, they are x, y,
and ydelta. If four columns are given, they are x, y, ylow, and
yhigh.

Examples:

\begin{verbatim}
        plot "data.dat" using 1:2:3:4 with errorbars
        plot "data.dat" using 3:2:6 with errorbars
        plot "data.dat" using 3:4:8:7 with errorbars
\end{verbatim}

The first example reads, x, y, ylow, and yhigh, from columns 1, 2, 3,
and 4. This is equivalent to the default.  The second example reads x
from the third column, y from second and ydelta from the sixth column.
The third example reads x from the third column, y from the fourth,
ylow from the eighth, and yhigh from seventh columns.

See also {\bf plot using} and {\bf plot style}.
\subsection{Parametric}
When in parametric mode ({\bf set parametric}) mathematical expressions must
be given in pairs for {\bf plot} and in triplets for {\bf splot}:
\begin{verbatim}
        plot sin(t),t**2
\end{verbatim}
or
\begin{verbatim}
        splot cos(u)*cos(v),cos(u)*sin(v),sin(u)
\end{verbatim}

Data files are plotted as before, except any preceding parametric
function must be fully specified before a data file is given as a
plot. In other words, the x parametric function (sin(t) above) and
the y parametric function (t**2 above) must not be interrupted with
any modifiers or data functions; doing so will generate a syntax error
stating that the parametric function is not fully specified.

Ranges take on a different meaning when in parametric mode. The first
range on the {\bf plot} command is the {\bf trange}, the next is the {\bf xrange},
and the last is the {\bf yrange}. For {\bf splot} the order is {\bf urange},
{\bf vrange}, {\bf xrange}, {\bf yrange}, and finally {\bf zrange}. The following
{\bf plot} command shows setting the {\bf trange} to [-pi:pi], the {\bf xrange} to
[-1.3:1.3] and the {\bf yrange} to [-1:1] for the duration of the plot:
\begin{verbatim}
        plot [-pi:pi] [-1.3:1.3] [-1:1] sin(t),t**2
\end{verbatim}

Other modifiers, such as {\bf with} and {\bf title}, may be specified only
after the parametric function has been completed:
\begin{verbatim}
        plot sin(t),t**2 title 'Parametric example' with linespoints
\end{verbatim}
\subsection{Ranges}
The optional range specifies the region of the plot that will be
displayed.

Ranges may be provided on the {\bf plot} and {\bf splot} command line and
affect only that plot, or in the {\bf set xrange}, {\bf set yrange}, etc.,
commands, to change the default ranges for future plots.

Syntax:
\begin{verbatim}
        [{<dummy-var> =} {<xmin> : <xmax>}] { [{<ymin> : <ymax>}] }
\end{verbatim}

where $<$dummy-var$>$ is the independent variable (the defaults are x and
y, but this may be changed with {\bf set dummy}) and the min and max
terms can be constant expressions.

Both the min and max terms are optional. The ':' is also optional
if neither a min nor a max term is specified. This allows '[ ]' to
be used as a null range specification.

Specifying a range in the {\bf plot} command line turns autoscaling for
that axis off for that plot. Using one of the {\bf set} range commands
turns autoscaling off for that axis for future plots, unless changed
later. (See {\bf set autoscale}).

Examples:

This uses the current ranges:
\begin{verbatim}
        plot cos(x)
\end{verbatim}

This sets the x range only:
\begin{verbatim}
        plot [-10:30] sin(pi*x)/(pi*x)
\end{verbatim}

This is the same, but uses t as the dummy-variable:
\begin{verbatim}
        plot [t = -10 :30]  sin(pi*t)/(pi*t)
\end{verbatim}

This sets both the x and y ranges:
\begin{verbatim}
        plot [-pi:pi] [-3:3]  tan(x), 1/x
\end{verbatim}

This sets only the y range, and turns off autoscaling on both axes:
\begin{verbatim}
        plot [ ] [-2:sin(5)*-8] sin(x)**besj0(x)
\end{verbatim}

This sets xmax and ymin only:
\begin{verbatim}
        plot [:200] [-pi:]  exp(sin(x))
\end{verbatim}

This sets the x, y, and z ranges:
\begin{verbatim}
        splot [0:3] [1:4] [-1:1] x*y
\end{verbatim}
\subsection{Style}
Plots may be displayed in one of six styles: {\bf lines}, {\bf points},
{\bf linespoints}, {\bf impulses}, {\bf dots}, or {\bf errorbars}. The {\bf lines} style
connects adjacent points with lines. The {\bf points} style displays a
small symbol at each point. The {\bf linespoints} style does both
{\bf lines} and {\bf points}. The {\bf impulses} style displays a vertical line
from the x axis (or from the grid base for {\bf splot}) to each point. The
{\bf dots} style plots a tiny dot at each point; this is useful for
scatter plots with many points.

The {\bf errorbars} style is only relevant to 2-d data file plotting. It
is treated like {\bf points} for {\bf splot}s and function {\bf plot}s. For data
{\bf plot}s, {\bf errorbars} is like {\bf points}, except that a vertical error 
bar is also drawn: for each point (x,y), a line is drawn from
(x,ylow) to (x,yhigh). A tic mark is placed at the ends of the error
bar. The ylow and yhigh values are read from the data file's columns,
as specified with the {\bf using} option to plot. See {\bf plot errorbars} for
more information.

Default styles are chosen with the {\bf set function style} and
{\bf set data style} commands.

By default, each function and data file will use a different 
line type and point type, up to the maximum number of available 
types. All terminal drivers support at least six different point
types, and re-use them, in order, if more than six are required.
The LaTeX driver supplies an additional six point types (all variants
of a circle), and thus will only repeat after twelve curves are
plotted with points.

If desired, the style and (optionally) the line type and point type
used for a curve can be specified.

Syntax:

\begin{verbatim}
        with <style> {<linetype> {<pointtype>}}
\end{verbatim}

where $<$style$>$ is either {\bf lines}, {\bf points}, {\bf linespoints}, {\bf impulses},
{\bf dots}, or {\bf errorbars}. The $<$linetype$>$ and $<$pointtype$>$ are positive
integer constants or expressions and specify the line type and point
type to be used for the plot. Line type 1 is the first line type used
by default, line type 2 is the second line type used by default, etc.

Examples:

This plots sin(x) with impulses:
\begin{verbatim}
        plot sin(x) with impulses
\end{verbatim}

This plots x*y with points, x**2 + y**2 default:
\begin{verbatim}
        splot x*y w points, x**2 + y**2
\end{verbatim}

This plots tan(x) with the default function style, ``data.1'' with lines:
\begin{verbatim}
        plot [ ] [-2:5] tan(x), "data.1" with l
\end{verbatim}

This plots ``leastsq.dat'' with impulses:
\begin{verbatim}
        plot 'leastsq.dat' w i
\end{verbatim}

This plots ``exper.dat'' with errorbars and lines connecting the points:
\begin{verbatim}
        plot 'exper.dat' w lines, 'exper.dat' w errorbars
\end{verbatim}
Here 'exper.dat' should have three or four data columns.

This plots x**2 + y**2 and x**2 - y**2 with the same line type:
\begin{verbatim}
        splot x**2 + y**2 with line 1, x**2 - y**2 with line 1
\end{verbatim}

This plots sin(x) and cos(x) with linespoints, using the
same line type but different point types:
\begin{verbatim}
        plot sin(x) with linesp 1 3, cos(x) with linesp 1 4
\end{verbatim}

This plots file ``data'' with points style 3:
\begin{verbatim}
        plot "data" with points 1 3 
\end{verbatim}
Note that the line style must be specified when specifying the point
style, even when it is irrelevant. Here the line style is 1 and the
point style is 3, and the line style is irrelevant.

See {\bf set style} to change the default styles.
\subsection{Title}
A title of each plot appears in the key. By default the title is
the function or file name as it appears on the plot command line.
The title can be changed by using the {\bf title} option. This option 
should precede any {\bf with} option.

Syntax:
\begin{verbatim}
        title "<title>"
\end{verbatim}

where $<$title$>$ is the new title of the plot and must be enclosed in
quotes. The quotes will not be shown in the key.

Examples:

This plots y=x with the title 'x':
\begin{verbatim}
        plot x
\end{verbatim}

This plots the ``glass.dat'' file with the title 'surface of revolution':
\begin{verbatim}
        splot "glass.dat" title 'surface of revolution'
\end{verbatim}

This plots x squared with title ``x\verb+^+2'' and ``data.1'' with title
'measured data':
\begin{verbatim}
        plot x**2 title "x^2", "data.1" t 'measured data'
\end{verbatim}
\section{Print}
The {\bf print} command prints the value of $<$expression$>$ to the screen.

Syntax:
\begin{verbatim}
        print <expression>
\end{verbatim}

See {\bf expressions}.
\section{Pwd}
The {\bf pwd} command prints the name of the working directory to the screen.

Syntax:
\begin{verbatim}
        pwd
\end{verbatim}
\section{Quit}
The {\bf exit} and {\bf quit} commands and END-OF-FILE character will exit
GNUPLOT. All these commands will clear the output device (as the
{\bf clear} command does) before exiting.
\section{Replot}
The {\bf replot} command without arguments repeats the last {\bf plot} or {\bf splot}
command. This can be useful for viewing a plot with different {\bf set}
options, or when generating the same plot for several devices.

Arguments specified after a {\bf replot} command will be added onto the last
{\bf plot} ({\bf splot}) command (with an implied ',' separator) before it is
repeated. {\bf replot} accepts the same arguments as the {\bf plot} ({\bf splot})
commands except that ranges cannot be specified. See {\bf command-line
editing} for ways to edit the last {\bf plot} ({\bf splot}) command.
\section{Save}
The {\bf save} command saves user-defined functions, variables, set
options or all three plus the last {\bf plot} ({\bf splot}) command to the
specified file.

Syntax:
\begin{verbatim}
        save  {<option>} "<filename>"
\end{verbatim}

where $<$option$>$ is {\bf functions}, {\bf variables} or {\bf set}. If no option is
used, GNUPLOT saves functions, variables, set options and the last {\bf plot}
({\bf splot}) command.

{\bf save}d files are written in text format and may be read by the {\bf load}
command.

The filename must be enclosed in quotes.

Examples:

\begin{verbatim}
        save "work.gnu"
        save functions 'func.dat'
        save var 'var.dat'
        save set "options.dat"
\end{verbatim}
\section{Set-show}
The {\bf set} command sets LOTS of options.

The {\bf show} command shows their settings. {\bf show all} shows all the
settings.
\subsection{Angles}
By default, GNUPLOT assumes the independent variable in polar plots
is in units of radians. If {\bf set angles degrees} is specified before
{\bf set polar} then the default range is [0:360] and the independent
variable has units of degrees. This is particularly useful for
plots of data files. The angle setting also hold for the 3-d
mapping as set via the {\bf set mapping} command.

Syntax:
\begin{verbatim}
        set angles { degrees | radians }
        show angles
\end{verbatim}
\subsection{Arrow}
Arbitrary arrows can be placed on a plot using the {\bf set arrow}
command.

Syntax:

\begin{verbatim}
         set arrow {<tag>} {from <sx>,<sy>{,<sz>}} 
                           {to <ex>,<ey>{,<ez>}} {{no}head}
         set noarrow {<tag>}
         show arrow
\end{verbatim}


Unspecified coordinates default to 0. The x, y, and z values are in
the graph's coordinate system. The z coordinate is only used in
{\bf splot} commands. $<$tag$>$ is an integer that identifies the arrow. If no
tag is given, the lowest unused tag value is assigned automatically.
The tag can be used to delete or change a specific arrow. To change
any attribute of an existing arrow, use the {\bf set arrow} command with
the appropriate tag, and specify the parts of the arrow to be
changed. Specifying nohead requests the arrow be drawn without a head
(yielding a line segment). By default, arrows have heads.

Arrows outside the plotted boundaries are permitted but may cause
device errors.

Examples:

To set an arrow pointing from the origin to (1,2), use:
\begin{verbatim}
         set arrow to 1,2
\end{verbatim}
To set an arrow from (-10,4,2) to (-5,5,3), and tag the arrow number
3, use:
\begin{verbatim}
         set arrow 3 from -10,4,2 to -5,5,3
\end{verbatim}
To change the preceding arrow begin at 1,1,1, without an arrow head,
use:
\begin{verbatim}
         set arrow 3 from 1,1,1 nohead
\end{verbatim}
To delete arrow number 2 use:
\begin{verbatim}
         set noarrow 2
\end{verbatim}
To delete all arrows use:
\begin{verbatim}
         set noarrow
\end{verbatim}
To show all arrows (in tag order) use:
\begin{verbatim}
         show arrow
\end{verbatim}
\subsection{Autoscale}
Auto scaling may be set individually on the x, y or z axis
or globally on all axes. The default is to autoscale all axes.

When autoscaling, the plot range is automatically computed and the
dependent axis (y for a {\bf plot} and z for {\bf splot}) is scaled to
include the range of the function or data being plotted.

If autoscaling of the dependent axis (y or z) is not set, the
current y or z range is used.

See {\bf set yrange} or {\bf set zrange}.

Autoscaling the independent variables (x for {\bf plot} and x,y for
{\bf splot}) is a request to set the domain to match any data file being
plotted. If there are no data files then autoscaling an independent
variable has no effect. In other words, in the absence of a data
file, functions alone do not affect the x range (or the y range if
plotting z = f(x,y)).

See {\bf set xrange}, or {\bf set yrange}.

The behavior of autoscaling remains consistent in parametric mode,
however, there are more dependent variables and hence more control
over x, y, and z plot scales. In parametric mode, the independent or
dummy variable is t for {\bf plot}s and u,v for {\bf splot}s.  Autoscale in
parametric mode, then, controls all ranges (t, u, v, x, y, and z) and
allows x, y, and z to be fully autoscaled.

See {\bf set parametric}.

Syntax:
\begin{verbatim}
        set autoscale <axes>
        set noautoscale <axes>
        show autoscale
\end{verbatim}

where $<$axes$>$ is either {\bf x}, {\bf y}, {\bf z} or {\bf xy}. If $<$axes$>$ is not given
then all axes are assumed.

Examples:

This sets autoscaling of the y axis. x axis autoscaling is not
affected.
\begin{verbatim}
        set autoscale y
\end{verbatim}

This sets autoscaling of the x and y axes.
\begin{verbatim}
        set autoscale xy
\end{verbatim}

This sets autoscaling of the x, y and z axes.
\begin{verbatim}
        set autoscale
\end{verbatim}

This disables autoscaling of the x, y and z axes.
\begin{verbatim}
        set noautoscale
\end{verbatim}

This disables autoscaling of the z axis only.
\begin{verbatim}
        set noautoscale z
\end{verbatim}
\subsubsection{Parametric mode}
When in parametric mode ({\bf set parametric}) the xrange is as
fully scalable as the yrange. In other words, in parametric
mode the x axis can be automatically scaled to fit the range
of the parametric function that is being plotted. Of course,
the y axis can also be automatically scaled just as in the
non-parametric case. If autoscaling on the x axis is not set,
the current x range is used.

When there is a mix of data files and functions, the xrange of
the functions is selected as that of the data files if autoscale
is true for x. While this keeps the behavior compatible with
non-parametric plotting, it may not be retained in the future.
The problem is that, in parametric mode, the x and y ranges are
not as distinguishable as in the non-parametric mode and this
behavior may not be the most useful.

For completeness a last command {\bf set autoscale t} is accepted.
However, the effect of this ``scaling'' is very minor. When
GNUPLOT determines that the t range would be empty it makes a
small adjustment if autoscaling is true. Otherwise, GNUPLOT
gives an error. Such behavior may, in fact, not be very useful
and the command {\bf set autoscale t} is certainly questionable.

{\bf splot} extends the above idea similarly. If autoscaling is set then
x, y, and z ranges are computed and each axis scaled to fit the
resulting data.
\subsection{Border}
The {\bf set border} and {\bf set noborder} commands controls the display of
the plot borders for the {\bf plot} and {\bf splot} commands.

Syntax:
\begin{verbatim}
        set border
        set noborder
        show border
\end{verbatim}
\subsection{Clip}
GNUPLOT can clip data points and lines that are near the boundaries
of a plot. 

Syntax:
\begin{verbatim}
        set clip <clip-type>
        set noclip <clip-type>
        show clip
\end{verbatim}

Three clip types are supported by GNUPLOT: {\bf points}, {\bf one}, and {\bf two}.
One, two, or all three clip types may be active for a single plot.

The {\bf points} clip type forces GNUPLOT to clip (actually, not plot at
all) data points that fall within but too close to the boundaries
(this is so the large symbols used for points will not extend outside
the boundary lines). Without clipping points near the boundaries may
look bad; try adjusting the x and y ranges.

Setting the {\bf one} clip type causes GNUPLOT to plot the line segments
which have only one of the two endpoints with the plotting region.
Only the in-range portion of the line is drawn.  The alternative is to
not draw any portion of the line segment.

Some lines may have both endpoints out of range, but pass through the
plotting area. Setting the {\bf two} clip-type allows the visible portion
of these lines to be drawn.

In no case is a line drawn outside the plotting area.

The defaults are {\bf noclip points}, {\bf clip one}, and {\bf noclip two}.

To check the state of all forms of clipping, use
\begin{verbatim}
        show clip
\end{verbatim}

For backward compatibility with older versions, the following forms
are also permitted.
\begin{verbatim}
       set clip
       set noclip
\end{verbatim}
{\bf set clip} is synonymous with {\bf set clip points}. {\bf set noclip} turns
off all three types of clipping.
\subsection{Cntrparam}
Sets the different parameters for the contouring plot (see also {\bf contour}).

Syntax:
\begin{verbatim}
        set cntrparam { { linear | cubicspline | bspline } |
                        points <n> |
                        levels <n> |
                        order <n> }
\end{verbatim}

This command controls the way contours are plotted. $<$n$>$ should be an
integral constant expression. The parameters are:

{\bf linear}, {\bf cubicspline}, {\bf bspline} - Controls type of approximation or
interpolation. If {\bf linear}, then the contours are drawn piecewise
linear, as extracted from the surface directly. If {\bf cubicspline}, then
piecewise linear contours are interpolated to form a somewhat smoother
contours, but which may undulate. The third option is the uniform
{\bf bspline}, which only approximates the piecewise linear data but is
guaranteed to be smoother.

{\bf points} - Eventually all drawings are done with piecewise linear
strokes.  This number controls the number of points used to
approximate a curve.  Relevant for {\bf cubicspline} and {\bf bspline} modes
only.

{\bf levels} - Number of contour levels. If the surface is bounded by zmin
and zmax then contours will be generated from zmin+dz to zmax-dz
in steps of size dz, where dz = (zmax - zmin) / (levels + 1).

{\bf order}  - Order of the bspline approximation to be used. The bigger this
order is, the smoother the resulting contour.  (Of course, higher order
bspline curves will move further away from the original peicewise linear
data.)  This option is relevant for {\bf bspline} mode only. Allowed values are 
integers in the range from 2 (linear) to 10.
\subsection{Contour}
Enable contour drawing for surfaces. This option is available for {\bf splot}
only.

Syntax:
\begin{verbatim}
        set contour { base | surface | both }
        set nocontour
\end{verbatim}

If no option is provided to {\bf set contour}, the default is {\bf base}.
The three options specify where to draw the contours: {\bf base} draws
the contours on the grid base where the x/ytics are placed, {\bf surface}
draws the contours on the surfaces themselves, and {\bf both} draws the
contours on both the base and the surface.

See also {\bf set cntrparam} for the parameters that affect the drawing of 
contours.
\subsection{Data style}
The {\bf set data style} command changes the default plotting style
for data plots.

Syntax:
\begin{verbatim}
        set data style 
        show data style 
        set data style <style-choice>
\end{verbatim}

In the first case, {\bf set data style} returns the possible style
choices:  {\bf lines}, {\bf points}, {\bf linespoints}, {\bf dots}, {\bf impulses}, 
or {\bf errorbars}.  {\bf show data style} shows the current default
plotting style for data.  {\bf set data style dots} would actually 
change the default plotting style.  See also {\bf plot}.
\subsection{Dummy}
By default, GNUPLOT assumes that the independent variable for the
{\bf plot} command is x, and the independent variables for the {\bf splot}
command are x and y. They are called the dummy variables because it
is just a notation to indicate the independent variables. The {\bf set
dummy} command changes these default dummy variable names. For
example, it may be more convenient to call the dummy variable t
when plotting time functions:

\begin{verbatim}
        set dummy t
        plot sin(t), cos(t)
\end{verbatim}

Syntax:
\begin{verbatim}
        set dummy <dummy-var>{,<dummy-var>}
        show dummy
\end{verbatim}

Examples:
\begin{verbatim}
        set dummy u,v
        set dummy ,s
\end{verbatim}

to set both dummy variables to u and v or set only the second
variable to s.

The {\bf set parametric} command also changes the dummy variables (to t
for {\bf plot} and u,v for {\bf splot}s).

\subsection{Format}
The format of the tic-mark labels can be set with the {\bf set format}
command. The default format for both axes is ''\%g'', but other formats
such as ''\%.2f'' or ''\%3.0fm'' are often desirable. Anything accepted by
printf when given a double precision number, and then accepted by the
terminal, will work. In particular, the formats f, e, and g will work,
and the d, o, x, c, s, and u formats will not work.

Syntax:
\begin{verbatim}
        set format {<axes>} {"<format-string>"}
        show format
\end{verbatim}

where $<$axes$>$ is either {\bf x}, {\bf y}, {\bf z}, {\bf xy}, or nothing (which is the
same as {\bf xy}). The length of the string representing a ticmark (after
formatting with printf) is restricted to 100 characters.  If the
format string is omitted, the format will be returned to the default
''\%g''. For LaTeX users, the format ''\$\%g\$'' is often desirable.  If the
empty string '''' is used, no label will be plotted with each tic,
though the tic mark will still be plotted. To eliminate all tic marks,
use {\bf set noxtics} or {\bf set noytics}.

See also {\bf set xtics} and {\bf set ytics} for more control over tic labels.
\subsection{Function style}
The {\bf set function style} command changes the default plotting style
for functions.

Syntax:
\begin{verbatim}
        set function style 
        show function style 
        set function style <style-choice>
\end{verbatim}

In the first case, {\bf set function style} returns the possible style
choices:  {\bf lines}, {\bf points}, {\bf linespoints}, {\bf dots}, {\bf impulses}, 
or {\bf errorbars}.  {\bf show function style} shows the current default
plotting style for functions.  {\bf set function style linespoints}
would actually change the default plotting style.  See also {\bf plot}.
\subsection{Functions}
The {\bf show functions} command lists all user-defined functions and
their definitions.

Syntax:
\begin{verbatim}
        show functions
\end{verbatim}
\subsection{Grid}
The optional {\bf set grid} draws a grid at the tic marks with the axis
linetype.

Syntax:
\begin{verbatim}
        set grid
        set nogrid
        show grid
\end{verbatim}
\subsection{Hidden3d}
The {\bf set hidden3d} command enables hidden line removal for explicit
surface plotting (see {\bf splot}).
Hidden line removal may be used for both explicit functions
and for explicit data where gnuplot plot is in nonparametric mode (see
{\bf set parametric}).

When this flag is set both the surface hidden portion and possibly
its hidden contours (see {\bf set contour}) as well as the hidden grid will be
removed. Labels and arrows are always visible and are unaffected by this
command.

Each surface has its hidden part removed with respect to itself, if more
than one surface is ploted. This mode is meaningfull when surfaces are
plotted using line style drawing only.

Syntax:
\begin{verbatim}
        set hidden3d
        set nohidden3d
        show hidden3d
\end{verbatim}
\subsection{Isosamples}
An isoline is a curve parametrized by one of the surface parameters
while the other surface parameter is fixed. Isolines are a simple
means to display a surface. By fixing the u parameter of surface
s(u,v), the iso-u lines of the form c(v) = s(u0,v) are produced, and
by fixing the v parameter, the iso-v lines of the form c(u) = s(u,v0)
are produced.

The isoline density of surfaces may be changed by the {\bf set isosamples}
command. By default, sampling is set to 10 isolines per u or v axis.
A higher sampling rate will produce more accurate plots, but will take
longer. This parameter has no effect on data file plotting.

Syntax:
\begin{verbatim}
        set isosamples <expression>
        show isosamples
\end{verbatim}
\subsection{Key}
The {\bf set key} enables a key describing curves on a plot.  By default
the key is placed in the upper right corner of the plot.

Syntax:
\begin{verbatim}
        set key
        set key <x>,<y>{,<z>}
        set nokey
        show key
\end{verbatim}

The coordinates $<$x$>$, $<$y$>$ (and $<$z$>$ for {\bf splot}s) specify the location
of the key on the plot. The key is drawn as a sequence of lines, with
one plot described on each line. On the right hand side of each line
is a representation that attempts to mimic the way the curve is
plotted.  On the left side of each line is the text description,
obtained from the {\bf plot} command. See {\bf plot title} to change this
description. The lines are vertically arranged so an imaginary
straight line divides the left- and right-hand sides of the key. It is
the coordinates of this line that are specified with the {\bf set key}
command. In a {\bf plot}, only the x and y coordinates are used to specify
the line position.  For a {\bf splot}, x, y and z are all being used as a
3-d location mapped using the same mapping as the plot itself to form
the required 2-d screen position of the imaginary line.

Some or all of the key may be outside of the plot boundary, although
this may interfere with other labels and may cause an error on some
devices.

Examples:

This places the key at the default location:
\begin{verbatim}
        set key
\end{verbatim}
This disables the key:
\begin{verbatim}
        set nokey
\end{verbatim}
This places a key at coordinates 2,3.5,2
\begin{verbatim}
        set key 2,3.5,2
\end{verbatim}
\subsection{Label}
Arbitrary labels can be placed on the plot using the {\bf set label}
command.  If the z coordinate is given on a {\bf plot} it is ignored; if
it is missing on a {\bf splot} it is assumed to be 0.

Syntax:

\begin{verbatim}
         set label {<tag>} {"<label_text>"} {at <x>,<y>{,<z>}}
                           {<justification>}
         set nolabel {<tag>}
         show label
\end{verbatim}


The text defaults to '''', and the position to 0,0,0.  The $<$x$>$, $<$y$>$, and
$<$z$>$ values are in the graph's coordinate system.  The tag is an
integer that is used to identify the label. If no $<$tag$>$ is given, the
lowest unused tag value is assigned automatically. The tag can be used
to delete or change a specific label. To change any attribute of an
existing label, use the {\bf set label} command with the appropriate tag,
and specify the parts of the label to be changed.

By default, the text is placed flush left against the point x,y,z.
To adjust the way the label is positioned with respect to the point
x,y,z, add the parameter $<$justification$>$, which may be {\bf left}, {\bf right}
or {\bf center}, indicating that the point is to be at the left, right or
center of the text. Labels outside the plotted boundaries are
permitted but may interfere with axes labels or other text.

Examples:

To set a label at (1,2) to ``y=x'' use:
\begin{verbatim}
         set label "y=x" at 1,2
\end{verbatim}
To set a label ``y=x\verb+^+2'' with the right of the text at (2,3,4), and tag
the label number 3, use:
\begin{verbatim}
         set label 3 "y=x^2" at 2,3,4 right
\end{verbatim}
To change the preceding label to center justification, use:
\begin{verbatim}
         set label 3 center
\end{verbatim}
To delete label number 2 use:
\begin{verbatim}
         set nolabel 2
\end{verbatim}
To delete all labels use:
\begin{verbatim}
         set nolabel
\end{verbatim}
To show all labels (in tag order) use:
\begin{verbatim}
         show label
\end{verbatim}

(The Latex, EEPIC, and Imagen drivers allow $\backslash$$\backslash$ in a string to specify
a newline.)
\subsection{Logscale}
Log scaling may be set on the x, y, and z axes.

Syntax:
\begin{verbatim}
        set logscale <axes>
        set nologscale <axes>
        show logscale
\end{verbatim}

where $<$axes$>$ may be any combinations of {\bf x}, {\bf y}, and {\bf z}, in any
order.  If $<$axes$>$ is not given then all three axes are assumed.  The
command {\bf set logscale} turns on log scaling on the specified axes,
while {\bf set nologscale} turns off log scaling.

Examples:

To enable log scaling in both x and z axes:
\begin{verbatim}
       set logscale xz
\end{verbatim}
To disable z axis log scaling:
\begin{verbatim}
       set nologscale z
\end{verbatim}
\subsection{Mapping}

Syntax:
\begin{verbatim}
        set mapping { cartesian | spherical | cylindrical }
\end{verbatim}

Data for {\bf splot}s are usually in regular Euclidean space and are
provided in Cartesian coordinates. Such 3-d data require three
coordinates (x, y and z) or one coordinate (only z) in each line in
the data file.  In order to be able to use spherical or cylindrical
coordinate systems, use the {\bf set mapping} command. In both cases two
coordinates are expected in each line of the data. For a spherical
coordinate system, these are theta and phi (in units as specified by
{\bf set angles}) and the mapping is:

\begin{verbatim}
        x = cos( theta ) * cos( phi )
        y = sin( theta ) * cos( phi )
        z = sin( phi )
\end{verbatim}

For a cylindrical coordinate system, the mapping uses two variables,
theta (in units as specified by {\bf set angles}) and z:

\begin{verbatim}
        x = cos( theta )
        y = sin( theta )
        z = z
\end{verbatim}

Again, note that mapping will affect data file {\bf splot}s only.
\subsection{Offsets}
The amount of the graph that the plot takes up may be controlled to
some extent with the {\bf set offsets} command. This command takes four
offset arguments: $<$left$>$, $<$right$>$, $<$top$>$ and $<$bottom$>$. By default,
each offset is 0. Each offset may be a constant or an expression. Left
and right offsets are given in units of the x axis, while top and
bottom offsets are given in units of the y axis. The plot of sin(x),
displayed with offsets of 0, 0, 2, 2 will take up 1/3 of the
displayed y axis. Offsets are particularly useful with polar
coordinates as a means of compensating for aspect ratio distortion.
Offsets are ignored in {\bf splot}s.

Syntax:
\begin{verbatim}
        set offsets <left>, <right>, <top>, <bottom>
        show offsets
\end{verbatim}
\subsection{Output}
By default, plots are displayed to the standard output. The {\bf set
output} command redirects the display to the specified file or
device.

Syntax:
\begin{verbatim}
        set output {"<filename>"}
        show output
\end{verbatim}

The filename must be enclosed in quotes. If the filename is
omitted, output will be sent to the standard output.

On machines with popen functions (UNIX), output can be piped
through a shell command if the first letter of the filename
is '$|$'.  For instance,

Syntax:
\begin{verbatim}
        set output "|lpr -Plaser filename"
        set output "|lp -dlaser filename"
\end{verbatim}

(On MSDOS machines, set output ``prn'' will direct the output
to the default printer.)

\subsection{Parametric}
The {\bf set parametric} command changes the meaning of {\bf plot} ({\bf splot})
from normal functions to parametric functions. The command
{\bf set noparametric} changes the plotting style back to normal,
single-valued expression plotting.

In 2-d plotting, a parametric function is determined by a pair
of parametric functions operating on a parameter. An example
of a 2-d parametric function would be plot sin(t),cos(t) (which
defines a circle).

For 3-d plotting, the surface is described as x=f(u,v), y=g(u,v),
z=h(u,v). Therefore a triplet of functions are required. An example of
3-d parametric function would be cos(u)*cos(v),cos(u)*sin(v),sin(u)
(which defines a sphere). It takes three parametric function
specifications in terms of the parametric dummy arguments to describe
a single graph.

The total set of possible plots is a superset of the simple f(x)
style plots, since the two (three) functions can describe the
x and y (and z) values to be computed separately. In fact,
plots of the type t,f(t) (u,v,f(u,v)) are equivalent to those
produced with f(x) when the x values are computed using the
identity function as the first function.

Note that the order the parametric functions are specified is
xfunction, yfunction (and zfunction) and that each operates over the
common parametric domain.

Also, the {\bf set parametric} function implies a new range of values.
Whereas the normal f(x) and f(x,y) style plotting assume an xrange
and yrange (and zrange), the parametric mode additionally specifies a
trange, urange, and vrange. These ranges may be set
directly with {\bf set trange}, {\bf set urange} and {\bf set vrange}, or by
specifying the range on the {\bf plot} or {\bf splot} commands. Currently
the default range for these parametric variables is [-5:5].
Setting the ranges to something more meaningful is expected.
\subsection{Polar}
The {\bf set polar} command changes the meaning of the plot from
rectangular coordinates to polar coordinates. In polar coordinates,
the dummy variable (x) is an angle. The range of this angle is changed
from whatever it was to [0:2*pi], or, if degree unit has been selected,
to [0:360] (see {\bf set angles}).

The command {\bf set nopolar} changes the meaning of the plot back to the
default rectangular coordinate system. The range of x is changed from
whatever it was to [-10:10].

The {\bf set polar} command is not supported for {\bf splot}s.  See the
{\bf set mapping} command for similar functionality for {\bf splot}s.

While in polar coordinates the meaning of an expression in x is really
r = f(x), where x is an angle of rotation. The xrange controls the
domain (the angle) of the function, and the yrange controls the range
(the radius). The plot is plotted in a rectangular box, and the x and
y axes are both in units of the radius. Thus, the yrange controls both
dimensions of the plot output. The tics and units are written along
the axes rather than at the left and bottom. These unit are offset by
$<$rmin$>$ specified by the {\bf rrange} (See {\bf set rrange}). It is not
possible to specify different output dimensions in the x or y
directions. The yrange can be used to shift the plot diagonally to
display only the first or third quadrants.

Syntax:
\begin{verbatim}
        set polar
        set nopolar
        show polar
\end{verbatim}
Example:
\begin{verbatim}
        set polar
        plot x*sin(x)
        plot [-2*pi:2*pi] [-3:3] x*sin(x)
\end{verbatim}
The first plot uses the default polar angular domain of 0 to 2*pi.
The radius (and the size of the plot) is scaled automatically. The
second plot expands the domain, and restricts the range of the radius
(and the size of the plot) to [-3:3].
\subsection{Rrange}
The {\bf set rrange} command sets the radial range used to compute x and y
values when in polar mode. If not in polar mode (see {\bf set polar}) then
this range is not used. Use of this command offsets the polar
singularity to the $<$rmin$>$ value and shifts the units on the axes tic
marks. For instance, {\bf set rrange [-40:40]} would set the origin to -40
and would plot values of radial values between -40 to 40. Thus, if
360 degrees of data were plotted, then the plot would extend 80 units
in radially from the origin.  To view the entire plot,  a 
{\bf set yrange [-80:80]} command would create a square viewport with
a circular plot tangent at the axes.  Because {\bf xrange} is used
specify the angular extent, only a square viewport can be specified
by {\bf yrange}.  For instance, {\bf set yrange [0:80]} would display the
first quadrant and {\bf set yrange [-80:0]} would display the third
quadrant.  Any square viewport of any size can be specified but it
is constrained to be centered on a 45 degree line.

This range may also be specified on the {\bf plot} command line when in
polar mode.

Syntax:
\begin{verbatim}
        set rrange [{<rmin> : <rmax>}]
\end{verbatim}

where $<$rmin$>$ and $<$rmax$>$ terms are constants or expressions.

Both the $<$rmin$>$ and $<$rmax$>$ terms are optional. Anything omitted will
not be changed, so 
\begin{verbatim}
        set rrange [:10]
\end{verbatim}
changes rmax to 10 without affecting rmin.
\subsection{Samples}
The sampling rate of functions may be changed by the {\bf set samples}
command. By default, sampling is set to 100 points. A higher sampling
rate will produce more accurate plots, but will take longer. This
parameter no longer has any effect on data-file plotting.

Syntax:
\begin{verbatim}
        set samples <expression>
        show samples
\end{verbatim}
\subsection{Size}
The {\bf set size} command scales the displayed size of the plot.  On some
terminals, changing the size of the plot will result in text being
misplaced. Increasing the size of the plot may produce strange
results. Decreasing is safer.

Syntax:

\begin{verbatim}
        set size {<xscale>,<yscale>}
        show size
\end{verbatim}

The $<$xscale$>$ and $<$yscale$>$ values are the scaling factors for the size.
The defaults (1,1) are selected if the scaling factors are omitted.

Examples: 

To set the size to normal size use:
\begin{verbatim}
        set size
\end{verbatim}
To make the plot half size use:
\begin{verbatim}
        set size 0.5,0.5
\end{verbatim}
To make a landscape plot have a 1:1 aspect ratio in polar mode use:
\begin{verbatim}
        set size 0.721,1.0
\end{verbatim}
To show the size use:
\begin{verbatim}
        show size
\end{verbatim}

For the LaTeX and Fig terminals the default size (scale factor 1,1)
is 5 inches wide by 3 inches high. The big Fig terminal ({\bf bfig}) is 7
inches wide by 5 inches high. The postscript default is landscape mode
10 inches wide and 7 inches high. 
Note that the size of the plot includes the space used by the labels; 
the plotting area itself is smaller. 
\subsection{Style}
Plots may be displayed in one of six styles: {\bf lines}, {\bf points},
{\bf linespoints}, {\bf impulses}, {\bf dots}, or {\bf errorbars}. The {\bf lines} style
connects adjacent points with lines. The {\bf points} style displays a
small symbol at each point. The {\bf linespoints} style does both
{\bf lines} and {\bf points}. The {\bf impulses} style displays a vertical line
from the x axis to each point. The {\bf dots} style plots a tiny dot at
each data point; this is useful for scatter plots with many points.

The {\bf errorbars} style is relevant only for to data file {\bf plot}s. It is
treated like {\bf points} for function {\bf plot}s and {\bf splot}s. For data file
{\bf plot}s, {\bf errorbars} is like {\bf points}, except that a vertical error
bar is also drawn: for each point (x,y), a line is drawn from (x,ylow)
to (x,yhigh). A tic mark is placed at the ends of the error bar. The
ylow and yhigh values are read from the data file's third and fourth
columns, or as specified with the {\bf using} option to plot.  See {\bf plot
errorbars} for more information.

Default styles are chosen with the {\bf set function style} and {\bf set
data style} commands. See {\bf plot style} for information about how
to override the default plotting style for individual functions.

Syntax:
\begin{verbatim}
        set function style <style>
        set data style <style>
        show function style
        show data style
\end{verbatim}

where $<$style$>$ is {\bf lines}, {\bf points}, {\bf linespoints}, {\bf impulses},
{\bf dots}, or {\bf errorbars}.
\subsection{Surface}
{\bf set surface} controls the display of surfaces. It is useful if
contours are to be displayed by themselves. Whenever {\bf set nosurface}
is issued, no surface isolines/mesh will be drawn. See also {\bf set
contour}.

Syntax:
\begin{verbatim}
        set surface
        set nosurface
        show surface
\end{verbatim}
\subsection{Terminal}
GNUPLOT supports many different graphics devices. Use the {\bf set
terminal} command to select the type of device for which GNUPLOT
will produce output.

Syntax:
\begin{verbatim}
        set terminal {<terminal-type>}
        show terminal
\end{verbatim}

If $<$terminal-type$>$ is omitted, GNUPLOT will list the available
terminal types. $<$terminal-type$>$ may be abbreviated.

Use {\bf set output} to redirect this output to a file or device.

Several terminals have additional options. For example, see {\bf dumb},
{\bf iris4d}, {\bf hpljii} or {\bf postscript}.
\subsubsection{Dumb}
The dumb terminal driver has an optional size specification.

Syntax:
\begin{verbatim}
        set terminal dumb {<xsize> <ysize>}
\end{verbatim}

where $<$xsize$>$ and $<$ysize$>$ set the size of the dumb terminals. Default
is 79 by 24.

Examples:
\begin{verbatim}
        set term dumb
        set term dumb 79 49 #(VGA screen - why would anyone want to do that!?)
\end{verbatim}

\subsubsection{Hpljii}
The HP LaserJet II and HP DeskJet drivers have a single option.

Syntax:
\begin{verbatim}
        set terminal hpljii {<resolution>}
        set terminal hpdj   {<resolution>}
\end{verbatim}

where $<$resolution$>$ is the resolution of the output in dots per inch.
It must be {\bf 75}, {\bf 100}, {\bf 150} or {\bf 300}.

Example:
\begin{verbatim}
        set terminal hpljii 150
\end{verbatim}

\subsubsection{Iris4d}
The iris4d driver can operate in two modes.

Syntax:
\begin{verbatim}
        set terminal iris4d {24}
\end{verbatim}

If the hardware supports only 8 bits, use the default {\bf set terminal
iris4d}. If, however, the hardware supports 24 bits (8 per
red/green/blue), use {\bf set terminal iris4d 24}.

When using 24-bit mode, the colors can be directly specified via the
file .gnuplot\_iris4d that is searched in the current directory and
then in the home directory specified by the HOME environment variable.
This file holds RGB values for the background, border, labels and nine
plotting colors, in that order. For example, here is a file containing
the default colors:

\begin{verbatim}
        85   85   85     /* Back Ground */
        0    0    0      /* Boundary */
        170  0    170    /* Labeling */
        85   255  255    /* Plot Color 1 */
        170  0    0      /* Plot Color 2 */
        0    170  0      /* Plot Color 3 */
        255  85   255    /* Plot Color 4 */
        255  255  85     /* Plot Color 5 */
        255  85   85     /* Plot Color 6 */
        85   255  85     /* Plot Color 7 */
        0    170  170    /* Plot Color 8 */
        170  170  0      /* Plot Color 9 */
\end{verbatim}

This file has exactly 12 lines of RGB triples. No empty lines are
allowed and anything after the third number in line is ignored.

\subsubsection{Pbm}
Several options may be set in the PBMplus driver.

Syntax:
\begin{verbatim}
        set terminal pbm {<fontsize>}
        set terminal pgm {<fontsize>}
        set terminal ppm {<fontsize>}
\end{verbatim}

where $<$fontsize$>$ is {\bf small}, {\bf medium}, or {\bf large}. 
Default size is 640 pixels wide and 480 pixels high.
The pbm output is a portable bitmap (one bit per pixel).
The pgm output is a portable graymap (three bits per pixel). 	
The ppm output is a portable pixmap (color, four bits per pixel).
The output of these drivers can be used with Jef Poskanzer's 
excellent PBMPLUS package which provides programs to convert
the above PBMPLUS formats to GIF, TIFF, MacPaint, Macintosh PICT,
PCX, X11 bitmap and many others. 

Examples:

\begin{verbatim}
        set term pbm small
        set size 2,2
        set term ppm medium
\end{verbatim}

\subsubsection{Postscript}
Several options may be set in the PostScript driver.

Syntax:
\begin{verbatim}
        set terminal postscript {<mode>} {<color>}
                                {"<fontname>"} {<fontsize>}
\end{verbatim}

where $<$mode$>$ is {\bf landscape}, {\bf portrait}, {\bf eps} or {\bf default}. 
Selecting default sets all options to their defaults.
$<$color$>$ is either {\bf color} or {\bf monochrome}.
''$<$fontname$>$'' is the name of a valid PostScript font.
$<$fontsize$>$ is the size of the font in PostScript points, before 
scaling by the {\bf set size} command.
Defaults are {\bf landscape}, {\bf monochrome}, ``Courier'', and 14pt.
Default size of PostScript plot is landscape mode 10 inches wide 
and 7 inches high.

To get EPS output, use the {\bf eps} mode and make only one plot per file.
In {\bf eps} mode the whole plot is halved in size; the fonts are half the 
given size, and the plot is 5 inches wide and 3.5 inches high.

Examples:

\begin{verbatim}
        set term postscript default       # old postscript
        set term postscript landscape 22  # old psbig
        set term postscript eps 14   # old epsf1
        set term postscript eps 22   # old epsf2
        set size 0.7,1.4
        set term post portrait color "Times-Roman" 14 
\end{verbatim}

\subsubsection{Aifm}
Several options may be set in the Adobe Illustrator 3.0 driver.

Syntax:
\begin{verbatim}
        set terminal aifm {<color>}
                                {"<fontname>"} {<fontsize>}
\end{verbatim}

Selecting default sets all options to their defaults.
$<$color$>$ is either {\bf color} or {\bf monochrome}.
''$<$fontname$>$'' is the name of a valid PostScript font.
$<$fontsize$>$ is the size of the font in PostScript points, before 
scaling by the {\bf set size} command.
Defaults are {\bf monochrome}, ``Courier'', and 14pt.

Also, since AI does not really support multiple pages, multiple 
graphs will be output directly on one another.  However, each graph 
will be grouped individually, making it easy to separate them inside 
AI (just pick them up and move them).

Examples:

\begin{verbatim}
        set term aifm 
        set term aifm 22  
        set size 0.7,1.4
        set term aifm color "Times-Roman" 14 
\end{verbatim}

\subsubsection{Table}
Instead of producing a picture, term type 'table' prints out
the evaluation results in a multicolumn ASCII table of X Y Z values.
For those times when you really want to see the numbers, now you
can see them on the screen or save to a file.

\subsection{Tics}
By default, tics are drawn inwards from the border on all four sides.
The {\bf set tics} command can be used to change the tics to be 
drawn outwards on the left and bottom borders only.
This is useful when doing impulse plots.

Syntax:
\begin{verbatim}
        set tics {<direction>}
        show tics
\end{verbatim}

where $<$direction$>$ may be {\bf in} or {\bf out}. {\bf set tics} defaults to {\bf in}.

See also the {\bf set xtics}, {\bf set ytics}, and {\bf set ztics} command for more
control of tic marks.
Using splot, in 3-d plots, one can adjust the relative height of the
vertical (Z) axis using {\bf set ticslevel}. The numeric argument provided
specifies the location of the bottom of the scale. a zero will put it
on the bottom grid and any positive number somewhere along the z axis.

Syntax:
\begin{verbatim}
        set ticslevel {<level>}
        show tics
\end{verbatim}

where $<$level$>$ is a non negative numeric argument. For example,

\begin{verbatim}
        set ticslevel 0.5
\end{verbatim}

sets the tics level to the default value.

See also the {\bf set view}.
\subsection{Time}
The optional {\bf set time} places the time and date of the plot either
at the top or bottom of the left margin. The exact location is
device dependent.

Syntax:
\begin{verbatim}
        set time {<xoff>}{,<yoff>}
        set notime
        show time
\end{verbatim}

Specifying constants $<$xoff$>$ or $<$yoff$>$ as optional offsets for the time
will move the time $<$xoff$>$ or $<$yoff$>$ character screen coordinates. For
example,

\begin{verbatim}
        set time ,-3
\end{verbatim}

will change only the y offset of the time, moving the title down by
roughly the height of three characters.

\subsection{Title}
The {\bf set title} command produces a plot title that is centered at the
top of the plot. Using the optional x,y screen offsets, the title
can be placed anywhere on the plot. {\bf set title} with no parameters
clears the title.

Syntax:
\begin{verbatim}
         set title {"<title-text>"} {<xoff>}{,<yoff>}
         show title
\end{verbatim}

Specifying constants $<$xoff$>$ or $<$yoff$>$ as optional offsets for the
title will move the title $<$xoff$>$ or $<$yoff$>$ character screen
coordinates. Note these are screen coordinates and not plot
coordinates. For example,

\begin{verbatim}
         set title ,-1
\end{verbatim}

will change only the y offset of the title, moving the title down by
roughly the height of one character.

(The Latex, EEPIC, and Imagen drivers allow $\backslash$$\backslash$ in a string to specify
a newline.)
\subsection{Trange}
The {\bf set trange} command sets the parametric range used to compute
x and y values when in parametric mode. If not in parametric mode
(see {\bf set parametric}) then this range is not used. This command
does not affect x/y autoscaling or x/y ranges.

This range may also be specified on the {\bf plot} command line when
in parametric mode.

Syntax:
\begin{verbatim}
        set trange [{<tmin> : <tmax>}]
\end{verbatim}

where $<$tmin$>$ and $<$tmax$>$ terms are constants or expressions.

Both the $<$tmin$>$ and $<$tmax$>$ terms are optional. Anything omitted will
not be changed, so 
\begin{verbatim}
        set trange [:10]
\end{verbatim}
changes tmax to 10 without affecting tmin.  See also {\bf set urange} and
{\bf set parametric}.
\subsection{Urange}
The {\bf set urange} and {\bf set vrange} commands sets the parametric ranges used 
to compute x, y, and z values when in {\bf splot} parametric mode. If not in 
parametric mode (see {\bf set parametric}) then these ranges are not used. This 
command does not affect x/y autoscaling or x/y ranges.

This range may also be specified on the {\bf splot} command line when
in parametric mode.  See {\bf plot} for more information

Syntax:
\begin{verbatim}
        set urange [{<umin> : <umax>}]
\end{verbatim}

where $<$umin$>$ and $<$umax$>$ terms are constants or expressions.

Both the $<$umin$>$ and $<$umax$>$ terms are optional. Anything omitted will
not be changed, so 
\begin{verbatim}
        set urange [:10]
\end{verbatim}
changes umax to 10 without affecting umin.  See also {\bf set trange}.
\subsection{Variables}
The {\bf show variables} command lists all user-defined variables and
their values.

Syntax:
\begin{verbatim}
        show variables
\end{verbatim}
\subsection{View}
The {\bf set view} command sets the view point for {\bf splot}s. This
command controls the way the 3-d coordinates of the plot are mapped
into the 2-d screen space. This command provides controls to both
rotation and scaling of the plotted data but supports orthographic
projections only.

Syntax:
\begin{verbatim}
        set view <rot_x> {,{<rot_z>}{,{<scale>}{,<scale_z>}}}
        show view
\end{verbatim}

where $<$rot\_x$>$ and $<$rot\_z$>$ control the rotation angles (in degrees)
along a virtual 3-d coordinate system aligned with the screen such
that the screen horizontal axis is x, screen vertical axis is y, and
the axis perpendicular to the screen is z. $<$rot\_x$>$ is bounded to the
[0:180] range with a default of 60 degrees, while $<$rot\_z$>$ is bounded
to the [0:360] range with a default of 30 degrees. $<$scale$>$ controls
the scaling of the entire {\bf splot}, while $<$scale\_z$>$ scales the z axis
only. Both scales default to 1.0.

Examples:
\begin{verbatim}
        set view 60, 30, 1, 1
        set view ,,0.5
\end{verbatim}

The first sets all the four default values. The second changes 
only scale, to 0.5.

See also {\bf set ticslevel}.
\subsection{Vrange}
The {\bf set vrange} command is similar to the {\bf set urange} command.
Please see {\bf set urange}.
\subsection{Xlabel}
The {\bf set xlabel} command sets the x-axis label that is centered along
the x axis. Using the optional x,y screen offsets, the label can be
placed anywhere on the plot. {\bf set xlabel} with no parameters clears
the label.

Syntax: 
\begin{verbatim}
         set xlabel {"<label>"} {<xoff>}{,<yoff>}
         show xlabel
\end{verbatim}

Specifying constants $<$xoff$>$ or $<$yoff$>$ as optional offsets for the
label will move the label $<$xoff$>$ or $<$yoff$>$ character screen
coordinates. For example,

\begin{verbatim}
         set xlabel -1
\end{verbatim}

will change only the x offset of the xlabel, moving the label roughly
one character width to the left.

(The LaTeX, EEPIC, and Imagen drivers allow $\backslash$$\backslash$ in a string to specify
a newline.)
\subsection{Xrange}
The {\bf set xrange} command sets the horizontal range that will be
displayed. This command turns x axis autoscaling off.

This range may also be specified on the {\bf plot} command line.

Syntax:
\begin{verbatim}
        set xrange [{<xmin> : <xmax>}]
\end{verbatim}

where $<$xmin$>$ and $<$xmax$>$ terms are constants or expressions.

Both the $<$xmin$>$ and $<$xmax$>$ terms are optional. Anything omitted will
not be changed, so 
\begin{verbatim}
        set xrange [:10]
\end{verbatim}
changes xmax to 10 without affecting xmin.
\subsection{Xtics}
Fine control of the x axis tic marks is possible with the
{\bf set xtics} command. The x-axis tic marks may be turned off with the
{\bf set noxtics} command. They may be turned on (the default state) with
{\bf set xtics}.

Syntax:
\begin{verbatim}
         set xtics { {<start>, <incr>{, <end>}} |
                     {({"<label>"} <pos> {, {"<label>"} <pos>}...)} }
         set noxtics
         show xtics
\end{verbatim}

The $<$start$>$, $<$incr$>$, $<$end$>$ form specifies that a series of tics will
be plotted on the x axis between the x values $<$start$>$ and $<$end$>$
with an increment of $<$incr$>$. If $<$end$>$ is not given it is assumed to be
infinity. The increment may be negative. For example,
\begin{verbatim}
          set xtics 0,.5,10
\end{verbatim}
makes tics at 0, 0.5, 1, 1.5, ..., 9.5, 10.

The (''$<$label$>$'' $<$pos$>$, ...) form allows arbitrary tic positions or
non-numeric tic labels. A set of tics are a set of positions, each
with its own optional label. Note that the label is a string enclosed
by quotes, and may be a constant string, such as ``hello'', or contain
formatting information for the tic number (which is the same as the
position), such as ''\%3f clients''. See {\bf set format} for more
information about this case. The label may even be empty.
Examples:
\begin{verbatim}
         set xtics ("low" 0, "medium" 50, "high" 100)
         set xtics (1,2,4,8,16,32,64,128,256,512,1024)
         set xtics ("bottom" 0, "" 10, "top" 20)
\end{verbatim}

Tics will only be plotted when in range.

The {\bf set ytics} and {\bf set noytics} commands work identically.
See also the {\bf set format} command.
\subsection{Xzeroaxis}
{\bf set xzeroaxis} draws the x-axis. By default, this option is on.
{\bf set noxzeroaxis} causes GNUPLOT to omit the x-axis.

Syntax:
\begin{verbatim}
        set xzeroaxis
        set noxzeroaxis
        show xzeroaxis
\end{verbatim}
\subsection{Ylabel}
The {\bf set ylabel} command sets the y-axis label.  The position of this
label depends on the terminal, and can be one of the following three
positions (the position can be adjusted with optional parameters).

1. Horizontal text flushed left at the top left of the plot.
Terminals that cannot rotate text will probably use this method.

2. Vertical text centered vertically at the left of the plot.
Terminals that can rotate text will probably use this method.

3. Horizontal text centered vertically at the left of the plot.
The LaTeX and EEPIC drivers use this method. The user must insert 
line breaks using $\backslash$$\backslash$ to prevent the ylabel from overwriting
the plot. To produce a vertical row of characters, add $\backslash$$\backslash$
between every printing character (but this is ugly).

Syntax:  
\begin{verbatim}
         set ylabel {"<label>"} {<xoff>}{,<yoff>}
         show ylabel
\end{verbatim}

With no parameters, the label is cleared. Specifying constants $<$xoff$>$
or $<$yoff$>$ as optional offsets for the label will move the label $<$xoff$>$
or $<$yoff$>$ character screen coordinates. For example,

\begin{verbatim}
         set ylabel -1
\end{verbatim}

will change only the x offset of the ylabel, moving the label roughly
one character width left of its default position. This is especially
useful with the LaTeX driver.

(The LaTeX, EEPIC, and Imagen drivers allow $\backslash$$\backslash$ in a string to specify
a newline.)
\subsection{Yrange}
The {\bf set yrange} command sets the vertical range that will be
displayed. This command turns y axis autoscaling off.

This range may also be specified on the {\bf plot} command line.

Syntax:
\begin{verbatim}
        set yrange [{<ymin> : <ymax>}]
\end{verbatim}

where $<$ymin$>$ and $<$ymax$>$ terms are constants or expressions.

Both the $<$ymin$>$ and $<$ymax$>$ terms are optional. Anything omitted will
not be changed, so 
\begin{verbatim}
        set yrange [:10]
\end{verbatim}
changes ymax to 10 without affecting ymin.
\subsection{Ytics}
The {\bf set ytics} and {\bf set noytics} commands are similar to the {\bf set xtics}
and {\bf set noxtics} commands. Please see {\bf set xtics}.
\subsection{Yzeroaxis}
{\bf set yzeroaxis} draws the y-axis. By default, this option is on.
{\bf set noyzeroaxis} causes GNUPLOT to omit the y-axis.

Syntax:
\begin{verbatim}
        set yzeroaxis
        set noyzeroaxis
        show yzeroaxis
\end{verbatim}
\subsection{Zero}
The {\bf zero} value is the default threshold for values approaching 0.0.
GNUPLOT will not plot a point if its imaginary part is greater in
magnitude than the {\bf zero} threshold. Axis ranges cannot be less than
{\bf zero}. The default {\bf zero} value is 1e-8. This can be changed with
the {\bf set zero} command.

Syntax:
\begin{verbatim}
        set zero <expression>
        show zero
\end{verbatim}
\subsection{Zeroaxis}
{\bf set zeroaxis} draws the x-axis and y-axis. By default, this option is
on.  {\bf set nozeroaxis} causes GNUPLOT to omit the axes, and is
equivalent to {\bf set noxzeroaxis; set noyzeroaxis.}

Syntax:
\begin{verbatim}
        set zeroaxis
        set nozeroaxis
        show zeroaxis
\end{verbatim}
See {\bf set xzeroaxis} and {\bf set yzeroaxis}.
\subsection{Zlabel}
The {\bf set zlabel} command sets the z-axis label that is centered along
the z axis. Using the optional x,y screen offsets, the label can be
placed anywhere on the plot. {\bf set zlabel} with no parameters clears
the label.

Syntax: 
\begin{verbatim}
         set zlabel {"<label>"} {<xoff>}{,<yoff>}
         show zlabel
\end{verbatim}

Specifying constants $<$xoff$>$ or $<$yoff$>$ as optional offsets for the
label will move the label $<$xoff$>$ or $<$yoff$>$ character screen
coordinates. For example,

\begin{verbatim}
         set zlabel ,1
\end{verbatim}

will change only the y offset of the zlabel, moving the label roughly
one character height up.

The zlabel will be drawn whenever surfaces or contours are plotted,
in the space above the grid level.

(The LaTeX, EEPIC, and Imagen drivers allow $\backslash$$\backslash$ in a string to specify
a newline.)
\subsection{Zrange}
The {\bf set zrange} command sets the vertical range that will be
displayed. This command turns z axis autoscaling off.  The zrange is
used only by {\bf splot} and is ignored by {\bf plot}.

This range may also be specified on the {\bf splot} command line.

Syntax:
\begin{verbatim}
        set zrange [{<zmin> : <zmax>}]
\end{verbatim}

where $<$zmin$>$ and $<$zmax$>$ terms are constants or expressions.

Both the $<$zmin$>$ and $<$zmax$>$ terms are optional. Anything omitted will
not be changed, so
\begin{verbatim}
        set zrange [2:]
\end{verbatim}
changes zmin to 2 without affecting zmax.
\subsection{Ztics}
The {\bf set ztics} and {\bf set noztics} commands are similar to the {\bf set
xtics} and {\bf set noxtics} commands. Please see {\bf set xtics}.
\section{Shell}
The {\bf shell} command spawns an interactive shell. To return to
GNUPLOT, type {\bf logout} if using VMS, {\bf exit} or the END-OF-FILE
character if using Unix, {\bf endcli} if using AmigaDOS, or {\bf exit} if
using MS-DOS.

A single shell command may be spawned by preceding it with the !
character (\$ if using VMS) at the beginning of a command line.
Control will return immediately to GNUPLOT after this command is
executed. For example, in VMS, AmigaDOS, or MS-DOS,

\begin{verbatim}
     ! dir
\end{verbatim}

prints a directory listing and then returns to GNUPLOT.
\section{Splot}
Three-dimensional surface and contour plotting is available in
GNUPLOT with the {\bf splot} command. See the {\bf plot} command for features
common to the {\bf plot} command.

See also {\bf set contour}, {\bf set cntrparam}, and {\bf set surface}.
\section{Start-up}
When GNUPLOT is run, it looks for an initialization file to load.
This file is called {\bf .gnuplot} on Unix and AmigaDOS systems, and
{\bf GNUPLOT.INI} on other systems. If this file is not found in the
current directory, the program will look for it in the home directory
(under AmigaDOS and MS-DOS, the environment variable GNUPLOT should
contain the name of this directory).

If this file is found, GNUPLOT executes the commands in this file.
This is most useful for setting the terminal type and defining any
functions or variables that are used often.
\section{Substitution}
Command-line substitution is specified by a system command enclosed in
backquotes. This command is spawned and the output it produces
replaces the name of the command (and backquotes) on the command line.

Newlines in the output produced by the spawned command are replaced
with blanks.

Command-line substitution can be used anywhere on the GNUPLOT command
line.

Example:

This will run the program {\bf leastsq} and replace {\bf leastsq} (including
backquotes) on the command line with its output:

\begin{verbatim}
         f(x) = `leastsq`
\end{verbatim}

or, in VMS

\begin{verbatim}
         f(x) = `run leastsq`
\end{verbatim}
\section{User-defined}
New user-defined variables and functions of one or two variables may be 
declared and used anywhere.

User-defined function syntax:
\begin{verbatim}
        <function-name> ( <dummy-var1> {,<dummy-var2>} ) =  <expression>
\end{verbatim}

where $<$expression$>$ is defined in terms of $<$dummy-var1$>$ and $<$dummy-var2$>$.

User-defined variable syntax:
\begin{verbatim}
        <variable-name> = <constant-expression>
\end{verbatim}

Examples:
\begin{verbatim}
        w = 2
        q = floor(tan(pi/2 - 0.1))
        f(x) = sin(w*x)
        sinc(x) = sin(pi*x)/(pi*x)
        delta(t) = (t == 0)
        ramp(t) = (t > 0) ? t : 0
        min(a,b) = (a < b) ? a : b
        comb(n,k) = n!/(k!*(n-k)!)
\end{verbatim}

Note that the variable {\bf pi} is already defined.

See {\bf show functions} and {\bf show variables}.
\section{Bugs}
The bessel functions do not work for complex arguments.

The gamma function does not work for complex arguments.

There is a bug in the stdio library for old Sun operating systems
(SunOS Sys4-3.2). The ''\%g'' format for 'printf' sometimes incorrectly
prints numbers (e.g., 200000.0 as ``2''). Thus, tic mark labels may be
incorrect on a Sun4 version of GNUPLOT. A work-around is to rescale
the data or use the {\bf set format} command to change the tic mark format
to ''\%7.0f'' or some other appropriate format. This appears to have been
fixed in SunOS 4.0.

Another bug: On a Sun3 under SunOS 4.0, and on Sun4's under Sys4-3.2
and SunOS 4.0, the 'sscanf' routine incorrectly parses ``00 12'' with
the format ''\%f \%f'' and reads 0 and 0 instead of 0 and 12. This
affects data input. If the data file contains x coordinates that are
zero but are specified like '00', '000', etc, then you will read the
wrong y values. Check any data files or upgrade the SunOS.
It appears to have been fixed in SunOS 4.1.1.

Microsoft C 5.1 has a nasty bug associated with the \%g format for
printf. When any of the formats ''\%.2g'', ''\%.1g'', ''\%.0g'', ''\%.g'' are
used, printf will incorrectly print numbers in the range 1e-4 to 1e-1.
Numbers that should be printed in the \%e format are incorrectly 
printed in the \%f format, with the wrong number of zeros after the 
decimal point.

To work around this problem, use the \%e or \%f formats explicitly.

GNUPLOT, when compiled with Microsoft C, did not work correctly on two
VGA displays that were tested. The CGA, EGA and VGA drivers should 
probably be rewritten to use the Microsoft C graphics library.
GNUPLOT compiled with Turbo C uses the Turbo C graphics drivers and 
does work correctly with VGA displays.

VAX/VMS 4.7 C compiler release 2.4 also has a poorly implemented \%g 
format for printf. The numbers are printed numerically correct, but 
may not be in the requested format. The K\&R second edition says that 
for the \%g format, \%e is used if the exponent is less than -4 or greater 
than or equal to the precision. The VAX uses \%e format if the exponent 
is less than -1. The VAX appears to take no notice of the precision 
when deciding whether to use \%e or \%f for numbers less than 1.
To work around this problem, use the \%e or \%f formats explicitly.
From the VAX C 2.4 release notes:
e,E,f,F,g,G  Result will always contain a decimal  point.
For g and G, trailing zeros will not be removed from the result.

VAX/VMS 5.2 C compiler release 3.0 has a slightly better implemented
\%g format than release 2.4, but not much. Trailing decimal points are 
now removed, but trailing zeros are still not removed from \%g numbers 
in exponential format.

ULTRIX X11R3 has a bug that causes the X11 driver to display ``every
other'' plot.  The bug seems to be fixed in DEC's release of X11R4 so
newer releases of ULTRIX don't seem to have the problem.  Solutions for 
older sites include upgrading the X11 libraries (from DEC or direct from 
MIT) or defining ULTRIX\_KLUDGE when compiling the x11.trm file.  Note 
that the kludge is not an ideal fix, however.

The constant HUGE was incorrectly defined in the NeXT OS 2.0 operating
system.  HUGE should be set to 1e38 in plot.h. This error has been
corrected in the 2.1 version of NeXT OS.

Some older models of HP plotters do not have a page eject command 'PG'.
The current HPGL driver uses this command in HPGL\_reset.  This may need
to be removed for these plotters.  The current PCL5 driver uses HPGL/2
for text as well as graphics.  This should be modified to use scalable
PCL fonts.

Please report any bugs to bug-gnuplot@ames.arc.nasa.gov.
\end{document}
