Category : OS/2 Files
Archive   : GNUPLTPM.ZIP
Filename : GNUPLOT.TEX

 
Output of file : GNUPLOT.TEX contained in archive : GNUPLTPM.ZIP
\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 ""
\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 {}
\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 ""
\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