☰
◀ Previous △ Index Next ▶
F5.2.1} Commands
SAVING AND LOADING COMMANDS
~~~~~~~~~~~~~~~~~~~~~~~~~~~
call "{str:filename}" [ {val}, ... ]
- Up to ten optional parameters can be specified to call.
Their values are available inside the called script in the
variables $0 through $9. Inside the script, the variable
$# holds the number of parameters passed to call.
- call must be the last command on a multi-command line.
load "{str:filename}"
- Load commands from file and execute them.
- load must be the last command on a multi-command line.
save "{str:filename}"
save [ functions | variables | set | terminal ] "{str:filename}"
- Save details of the current session to file.
- functions | variables | set | terminal writes only
user-defined functions /variables / sets / terminal to file.
- Without any of the optional constraints, all user-defined
functions and variables, the
PLOTTING
~~~~~~~~
plot [ {ranges} ]
[ {function} | "{str:filename}" ]
[ index {int:start}[:{int:end}][:{int:step}] ]
[ every {int:step}[::{int:start}[::{int:end}]] ]
[ using {columnspec} ]
[ axes [ x1y1 | x1y2 | x2y1 | x2y2 ] ]
[ title [ "{str:explanation}" | {int:col} ]
| notitle ]
[ smooth [ unique | frequency | bezier | sbezier
| csplines | acsplines ] ]
[ with {stylespec} ]
[, ... ]
- Ranges are given as pairs in brackets: [min:max]. Leaving an
entry empty leaves the corresponding limit unchanged; supplying
a * turns on autoscaling for that limit. Up to two ranges can
be supplied: one to limit the x range, and one to constrain the
y range. In parametric mode, up to three ranges can be
supplied. The first measures the range of the parameter; the
following two are as before. A function can be supplied,
depending on a dummy variable called x in regular mode, or t in
parametric mode. (The name can be changed using set dummy.) A
text file containing data to plot can be specified.
- Supplying an empty filename reuses the most recently named file
in the same plot command. The special filename hyphen ( - )
indicates that data should be read from the same device that
the command was read from (usually standard input-the terminal
in interactive mode). index selects which data set(s) in the
input file should be plotted.
- Data sets are separated from each other by double blank lines
in the data file. Data sets are counted starting at zero.
- "every" controls how lines in multiline records should be read.
- "using" selects which columns should be used for x and y
values, and possibly other values as well (style-dependent).
- Column numbers start at 1. The pseudo column with column number
0 contains the line number (starting at zero) in the current
data set, resetting to zero when encountering a double blank
line. The pseudo column with column number -2 contains the index
of the current data set, which is incremented whenever a double
blank line is found. If a column number is enclosed in
parentheses, the expression within the parentheses is
evaluated and the result is used as if it were the column
value. Within such an expression, the value of each column can
be accessed by prefixing the column number with a dollar sign
($). axes indicates which set of axes the current data file or
function should be plotted against.
- "title" takes a string that will be placed as explanation into
the graph's key (legend). Supplying an empty string or the
notitle keyword suppresses the key entry. If the set key
autotitle columnhead option has been enabled, title takes an
integer argument that will be interpreted as a column number.
The first noncomment line in the column indicated will be used
as explanation in the graph-s key. smooth applies a smoothing
algorithm:
- "unique" sorts points by x value and replaces multiple data
points having the same x value with the average of the y values.
- frequency sorts points by x value and replaces multiple data
points having the same x value with the sum of the y values.
- bezier calculates the Bezier curve through all data points.
- sbezier applies the unique transformation and then calculates
the Bezier curve for the result.
- csplines applies the unique transformation, then calculates a
natural cubic spline interpolation, passing exactly
through all data points.
- acsplines applies the unique transformation, then calculates a
weighted cubic spline approximation. The weights
must be supplied through an additional column.
replot
Repeat the last plot or splot command.
splot [ {ranges} ]
[ {function} | "{str:filename}" ]
[ index {int:start}[:{int:end}][:{int:step}] ]
[ every {int:step}[::{int:start}[::{int:end}]] ]
[ using {columnspec} ]
[ title "{str:explanation}" | notitle ]
[ with {stylespec} ]
[, ... ]
- The syntax is similar to the plot command, except where the
additional dimension needs to be accommodated (additional range
and column specs).
OPTIONS
~~~~~~~
set ...
Set an option.
show ...
plot
[ variables [all] | functions ]
[ all | version ] [ long ]
Display information about the current session.
- Can be used with any option to see the current value of that
option.
- show plot displays the most recent plot command.
- "variables" and "functions" display only user-defined variables
and functions.
- "variables all" displays user-defined and gnuplot internal
variables.
reset
Reset all options to their system defaults.
unset ...
Disables an individual option or resets it to its default state.
SUBPROCESSES
~~~~~~~~~~~~
shell
Spawns an interactive shell.
system "{str:shellcmd}"
Executes a shell command and displays its output on the
screen.
TERMINAL HANDLING
~~~~~~~~~~~~~~~~~
clear
Clears the current output device.
- Clears the current output device as set by set output.
lower {int:winid}
Lowers a plot window.
raise {int:winid}
Raises a plot window.
test [palette]
test generates a standard test image, demonstrating line styles and point types,
CURVE FITTING
~~~~~~~~~~~~~
fit [ {ranges} ]
{function} "{str:datafile}"
[ index {int:start}[:{int:end}][:{int:step}] ]
[ every {int:step}[::{int:start}[::{int:end}]] ]
[ using {columnspec} ]
via [ {var1}, {var2}, ... | "{str:parameterfile}" ]
Performs a numerical, nonlinear least-squares fit. Most of the
syntax is similar to the syntax for the plot command and many
of the data selection and transformation directives available
for plot are also available for fit. Both the function to fit
and a file with the data must be supplied. The function must
depend on the dummy variable explicitly. The parameters named
in the via clause are varied to obtain the best fit result.
update "{str:filename}"
Writes the current values of the best-fit parameters to the
named file.
MISCELLANEOUS
~~~~~~~~~~~~~
bind
bind!
bind [allwindows] "{str:keys}" "{str:command}"
Change or display hot key bindings.
if ({condition}) {command}
[; else if ( {condition} ) {command} ]
[; else {command} ]
Conditional execution of commands.
pause {int:seconds} [ "{str:message}" ]
pause mouse [ {eventmask} ] [ "{str:message}" ]
Prints a message to the screen, then waits until a timer
expires or a user event occurs.
reread
If used within a file containing gnuplot commands, forces
gnuplot to read the file again from the
◀ Previous △ Index Next ▶