gnuplot 

Usage 

set [no]surface
set data style linespoints
set [no]hidden3d
set contour
set grid
#available when splot 'datafile' instead of matrix
set xrange [10:90]
set yrange [2:9]
splot 'datafile'
splot 'rslt.mat.te' matrix
show view
set view up-down, left-right, 1, 1
replot
set terminal gif
set output '111.gif'
set terminal postscript eps color
set output '111.ps'
datafile format
15 2 13.0
15 3 12.7
[...]
15 7 13.6
matrix file format
18.1 17.6 17.9 17.9 18.3 18.9 19.7 20.3
18.5 18.7 20.3 18.9 19.2 20.7 19.9 20.4
[...]
18.8 19.0 20.4 19.0 19.3 20.7 19.9 20.4
command splot is for 3-D plotting
command plot is for 2-D plotting

Info 

gnuplot plots 2d and 3d graphs, from a data file or with a formula. It has an interactive mode with online help, or it can be used non-interactively.

gnuplot does function fitting to data sets, and it does output to many terminals, among which are postscript, X11 display, PNG and GIF (via the old gd library).

help 

at

gnuplot user manual
/usr/doc/gnuplot-3.7.1/gnuplot.html

gnuplot for Latex
/usr/doc/gnuplot-3.7.1/tutorial.dvi

Source 

The new, official web site for gnuplot is now at www.gnuplot.org http://www.gnuplot.org/

The manual for gnuplot 3.7.1.
 http://www.ucc.ie/gnuplot/gnuplot.html

Related Urls 

  • Probably the most comprehensive gnuplot links page out there:

Bernhard Reiter: Gnuplot - Scientific Plotting
 http://www.usf.uni-osnabrueck.de/~breiter/tools/gnuplot/index.en.html

The old gnuplot pages at Dartmouth
 http://www.cs.dartmouth.edu/gnuplot_info.html

The newer pages
 http://members.theglobe.com/gnuplot/

http://www.geocities.com/SiliconValley/Foothills/6647/

An Introduction to GnuPlot at the University of Northern
 http://web.math-cs.uni.edu/cs/Help/gnuplot/TOC.html
       Iowa

A brief gnuplot tutorial by Henri Gavin
 http://www.duke.edu/~hpgavin/gnuplot.html

A vastly improved gnuplot-mode.el for Emacs or XEmacs
 http://feff.phys.washington.edu/~ravel/gnuplot/

A Bourne shell based gnuplot frontend by Michael Sternberg
 http://www.phys.uni-paderborn.de/~stern/pl/

A perl script to create filled boxes with the postscript
 http://www.uni-leipzig.de/~biopsych/widmann/boxfill-0.2.tar.gz
       terminal, by Andreas Widmann. The script draws boxed keys, and
       fills (and outlines) boxes by post-processing gnuplot postscript
       output.

Build 

./configure --prefix=/opt
make

Test Run 

cd demo
PATH=..:$PATH ../gnuplot all.dem

To run all demos non-interactively, use 

PATH=..:$PATH ../gnuplot all.dem </dev/null

Installation 

rpm -ivv ftp://rpmfind.net/linux/redhat/updates/6.2/en/os/i386/gnuplot-3.7.1-5.i386.rpm
pkg=gnuplot
make -n install | tee /export/pub/installs/logs/$pkg.log.0
make install | tee /export/pub/installs/logs/$pkg.log.1

Help 

File location defaults

PREFIX                          /usr/local
gnuplot                         PREFIX/bin
gnuplot_x11                     PREFIX/bin
gnuplot.1                       PREFIX/man/man1
gnuplot.gih                     PREFIX/share

The documentation is included in the source distribution. Look at the docs subdirectory, where you'll find

  • a Unix man page, which says how to start gnuplot
  • a help file, which also can be printed as a manual
  • a tutorial on using gnuplot with LATEX
  • a quick reference summary sheet for TEXonly

FAQs 

Does gnuplot support bar-charts/histograms/boxes?

Use the style "with boxes" for bar charts. To get filled boxes, you
can try a modification by Steve Cumming and jturk, available via ftp
from the contrib directory ftp.ucc.ie in
/pub/gnuplot/contrib/gpl37fboxpatch.tar.gz.
Bernhard Reiter wrote an AWK script to post-process the fig-terminal
output. Please have a look at
http://www.usf.uni-osnabrueck.de/ breiter/tools/gnuplot/barcharts.en.html.

4.4 Does gnuplot support pie charts?

It's not possible in gnuplot, but have a look at
http://www.usf.uni-osnabrueck.de/ breiter/tools/piechart/piecharts.en.html

4.8 Can I put both data files and commands into a single file?

This is possible by the new plot "-" possibility. The plot "-" command
allows to read the data to be plot from standard input or the current
batch job.

gnuplot> plot "-"

4.11 Can I put tic marks for x and y axes into 3d plots?

Use the "with boxes" option.

6.2 How do I run my data through a filter before plotting?

If your system supports the popen() function, as Unix does, you should
be able to run the output through another process, for example a short
awk program, such as

gnuplot> plot "< awk ' { print $1, $3/$2 } ' file.in"

The plot command is very powerful and is able to do some arithmetic on
datafiles. See "help plot".

6.5 How do I plot lines (not grids) using splot?

If the data in a data file for splot is arranged in such a way that
each one has the same number of data points (using blank lines as
delimiters, as usual), splot will plot the data with a grid. If you
want to plot just lines, use a different number of data entries (you
can do this by doubling the last data point, for example). Don't
forget to set parametric mode, of course.

7.4 Gnuplot is plotting nothing when run via gnuplot <filename>! What can I do?

Put a pause -1 after the plot command in the file. On an X-Window
System system, you can also use the -persist option, the X11 window is
then not closed. Close the X11 window by typing "q" when the focus is
on it.

7.10 Calling gnuplot in a pipe or with a gnuplot-script doesn't produce a plot!

You can call gnuplot by using a short Perl-script like the following:
#!/usr/local/bin/perl -w
open (GP, "|/usr/local/bin/gnuplot -persist") or die "no gnuplot";
# force buffer to flush after each write
use FileHandle;
GP->autoflush(1);
print GP,"set term x11;plot '/tmp/data.dat' with lines\n";
close GP