Gnuplot Pre-Compiled Executeables Source Code OSX Windows OS2 DOS Linux Here
Gnuplot Pre-Compiled Executeables Source Code OSX Windows OS2 DOS Linux Here
Gnuplot is a free, command-driven, interactive, function and data plotting program. Pre-
compiled executeables and source code for Gnuplot 4.2.4 may be downloaded for OS X,
Windows, OS2, DOS, and Linux. The enhancements provided by version 4.2 are described
here.
On Unix, Linux and OS X systems start Gnuplot by simply opening a terminal and typing:
gnuplot
For help on any topic type help followed by the name of the topic. Full documentation is
provided here.
2. FUNCTIONS
__________________________________________________________
Function Returns
----------- ------------------------------------------
abs(x) absolute value of x, |x|
acos(x) arc-cosine of x
asin(x) arc-sine of x
atan(x) arc-tangent of x
cos(x) cosine of x, x is in radians.
cosh(x) hyperbolic cosine of x, x is in radians
erf(x) error function of x
exp(x) exponential function of x, base e
inverf(x) inverse error function of x
invnorm(x) inverse normal distribution of x
log(x) log of x, base e
log10(x) log of x, base 10
norm(x) normal Gaussian distribution function
rand(x) pseudo-random number generator
sgn(x) 1 if x > 0, -1 if x < 0, 0 if x=0
sin(x) sine of x, x is in radians
sinh(x) hyperbolic sine of x, x is in radians
sqrt(x) the square root of x
tan(x) tangent of x, x is in radians
tanh(x) hyperbolic tangent of x, x is in radians
___________________________________________________________
Bessel, gamma, ibeta, igamma, and lgamma functions are also
supported. Many functions can take complex arguments.
Binary and unary operators are also supported.
The supported operators in Gnuplot are the same as the corresponding operators in the C
programming language, except that most operators accept integer, real, and complex
arguments. The ** operator (exponentiation) is supported as in FORTRAN. Parentheses
may be used to change the order of evaluation. The variable names x, y, and z are used as
the default independent variables.
plot and splot are the primary commands in Gnuplot. They plot functions and data in many
many ways. plot is used to plot 2-d functions and data, while splot plots 3-d surfaces and
data.
Syntax:
plot {[ranges]}
{[function] | {"[datafile]" {datafile-modifiers}}}
{axes [axes] } { [title-spec] } {with [style] }
{, {definitions,} [function] ...}
where either a [function] or the name of a data file enclosed in quotes is supplied. For more
complete descriptions, type: help plot help plot with help plot using or help plot smooth .
Discrete data contained in a file can be displayed by specifying the name of the data file
(enclosed in quotes) on the plot or splot command line. Data files should have the data
arranged in columns of numbers. Columns should be separated by white space (tabs or
spaces) only, (no commas). Lines beginning with a # character are treated as comments and
are ignored by Gnuplot. A blank line in the data file results in a break in the line connecting
data points.
For example your data file, force.dat , might look like:
Do not type blank space after the line continuation character, "\" .
Your data may be in multiple data files. In this case you may make your plot by using a
command like:
gnuplot> plot "fileA.dat" using 1:2 title 'data A', \
"fileB.dat" using 1:3 title 'data B'
For information on plotting 3-D data, type:
gnuplot> help splot datafile
Many items may be customized on the plot, such as the ranges of the axes, the labels of the
x and y axes, the style of data point, the style of the lines connecting the data points, and the
title of the entire plot.
Customization of the data columns, line titles, and line/point style are specified when the
plot command is issued. Customization of the data columns and line titles were discussed
in section 3.
Plots may be displayed in one of eight styles: lines, points, linespoints, impulses, dots,
steps, fsteps, histeps, errorbars, xerrorbars, yerrorbars, xyerrorbars, boxes, boxerrorbars,
boxxyerrorbars, financebars, candlesticks or vector To specify the line/point style use the
plot command as follows:
Customization of the axis ranges, axis labels, and plot title, as well as many other features,
are specified using the set command. Specific examples of the set command follow. (The
numerical values used in these examples are arbitrary.) To view your changes type: replot
at the gnuplot> prompt at any time.
Other features which may be customized using the set command are: arrow, border, clip,
contour, grid, mapping, polar, surface, time, view, and many more. The best way to learn is
by reading the on-line help information, trying the command, and reading the Gnuplot
manual. You may also post questions to the newsgroup comp.graphics.apps.gnuplot
The Gnuplot demo page and the gnuplot intro page have many examples like this script for
a transfer function producing this postscript plot.
If your data file has a comment character other than # you can tell Gnuplot about it. For
example, if your data file has "%" comment characters (for Matlab compatability), typing
6. GNUPLOT SCRIPTS
Sometimes, several commands are typed to create a particular plot, and it is easy to make a
typographical error when entering a command. To stream- line your plotting operations,
several Gnuplot commands may be combined into a single script file. For example, the
following file will create a customized display of the force-deflection data:
Then the total plot can be generated with the command: gnuplot> load 'force.p'
The curve-fit and data may now be plotted with the commands:
9. MULTI-PLOT
Gnuplot can plot more than one figure in a frame ( like subplot in matlab ) i.e., try:
Most of Gnuplot's current features are illustrated in one or more of the Gnuplot
demonstration files. To run the demo's yourself, download and unzip demo.zip, start
Gnuplot from the resulting demo directory, and type
load "all.dem"
The Gnuplot feature you are looking for will probably be illustrated in one of the demo
files. Gnuplot 4.2 also has an extensive FAQ.
You can create a PostScript file of your plot by using the following files and commands.
First, download and save the following general-purpose Gnuplot script: save.plt
Then simply type the following commands to create and print the plot
gnuplot> load 'save.plt'
gnuplot> !mv my-plot.ps force.ps
gnuplot> !lpr force.ps
The PostScript files produced by Gnuplot may be read and edited with a text editor. The
PostScript file format convention used by Gnuplot is described in this document by Richard
Crawford.
12. ADVANCED COMPUTATION AND VISUALIZATION
Gnuplot is used for plotting in a free and open Matlab-like programming environment
called Octave.
If you would like two figures to be laser-printed on the same page, you may use the
following shell script. Create file cat2 , below, and make the file executable by typing: unix
% chmod +x cat2
# cat2: Shell script for putting two Gnuplot plots on one page
echo %! > g.ps
echo gsave >> g.ps
echo 0 400 translate >> g.ps # for Gnuplot plots
cat $1 | sed -e "s/showpage//" >> g.ps
echo grestore >> g.ps
echo gsave >> g.ps
echo 0 090 translate >> g.ps # for Gnuplot plots
cat $2 >> g.ps
lpr -Phudsonlp1 g.ps