[comp.text.tex] Graphing in LaTeX

gt4589b@prism.gatech.EDU (Davis, Jr., Martin H.) (10/11/90)

A few weeks ago, I asked for advice on good scientific plotting pro-
grams that produce output suitable for inclusion in LaTeX files.  The
overwhelming vote was for Gnuplot.  What follows is an edited version
of the replies I got.

If I may suggest to the powers that be, I think it would be helpful
if an extract of this information were posted in the "frequently
asked questions" monthly posting.

Summary of replies:

From beck@cs.cornell.edu Sun Aug 26 21:22:10 1990

I suggest using GnuPlot 2.0, which can produce output either in
native LaTeX picture environment or in Fig code, an editable format
which can be translated into various LaTeX-compatible format.
Fig is described in the FAQ note.  I believe Gnuplot may also have an
EEPIC output driver, which is LaTeX compatible.

Alternately, there is a Plot2fig program which translates the Unix plot(5)
format to Fig.  I believe there are various Unix programs which produce
the plot(5) format.

Micah Beck
Cornell University

***********************************************************************

From huffman@baepv1.ncsu.edu Sun Aug 26 23:10:19 1990

I would recommend gnuplot (or xgnuplot, if you run X-windows).  It will do
just about everything you want except 3D plots.  You can compile in a
variety of output options.  You can view your plots on screen, then change
the output device and "replot" as LaTeX/Fig/PostScript/HPGL/etc.

Sources are available via anonymous ftp from prep.ai.mit.edu,

   pub/gnu/gnuplot2.0.tar.Z

The xgnuplot wrapper is on expo.lcs.mit.edu in the contrib directory.

I've found it a very handy.

Good luck.
-- 
Rod Huffman

************************************************************************

From smagt@fwi.uva.nl Mon Aug 27 04:19:43 1990

Your answer is gnuplot, I think.  If you don't know gnuplot (or
xplot, which is the same but creates an X-window): it interactively
creates figures of functions.
Available terminal types:
          unknown  Unknown terminal type - not a plotting device
            latex  LaTeX picture environment
            eepic  EEPIC -- extended LaTeX picture environment
       postscript  Postscript graphics language, small characters
            psbig  Postscript graphics language, big characters
            epsf1  Encapsulated Postscript graphics language, small characters
            epsf2  Encapsulated Postscript graphics language, big characters
              sun  SunView window system
          tek40xx  Tektronix 4010 and others; most TEK emulators

I append the man-page for gnuplot:

GNUPLOT(1)               USER COMMANDS                 GNUPLOT(1)



NAME
     gnuplot - an interactive plotting program

SYNOPSIS
     gnuplot file ...

DESCRIPTION
     Gnuplot is a command-driven  interactive  function  plotting
     program.

     If files are given, gnuplot loads each file  with  the  load
     command,  in  the  order specified.  Gnuplot exits after the
     last file is processed.

     Here are some of its features:

     Plots any number of functions, built up of  C  operators,  C
     library  functions,  and some things C doesn't have like **,
     sgn(), etc.  Also support for plotting data files,  to  com-
     pare actual data to theoretical curves.

     User-defined X and Y ranges (optional  auto-ranging),  smart
     axes scaling, smart tic marks.

     Labelling of X and Y axes.

     User-defined constants and functions.

     Support through a generalized graphics driver for  AED  512,
     AED  767, BBN BitGraph, Roland DXY800A, EEPIC, Epson LX-800,
     Fig, HP2623, HP2648, HP75xx, HPGL, IBM  Proprinter,  Imagen,
     Iris  4D,  Kermit-MS,  LaTeX, NEC CP6 pinwriter, PostScript,
     QMS QUIC, ReGis (VT125 and VT2xx), Selanar, Tek  401x,  Vec-
     trix 384, and unixplot. The PC version compiled by Microsoft
     C supports IBM CGA, EGA, VGA, Hercules, ATT 6300, and Corona
     325  graphics.  The  PC version compiled by Turbo C supports
     IBM CGA, EGA, MCGA, VGA and Hercules graphics. Other devices
     can be added simply, but will require recompiling.

     Shell escapes and command line substitution.

     Load and save capability.

     Output redirection.

     All computations performed in the complex domain.  Just  the
     real  part  is plotted by default, but functions like imag()
     and abs() and arg() are available to override this.

AUTHORS
     Thomas Williams, Pixar Corporation,
     (pixar!info-gnuplot@sun.com)
     and Colin Kelley.

     Additions for labelling by Russell Lang, Monash  University,
     Australia.
     (rjl@monu1.cc.monash.edu.au)
     Further additions by  David  Kotz,  Duke  University,  North
     Carolina, USA.
     (dfk@cs.duke.edu)

BUGS
     The atan() function does  not  work  correctly  for  complex
     arguments.
     See the help bugs command in gnuplot.

SEE ALSO
     See the printed manual or the on-line help  for  details  on
     specific commands.

Patrick van der Smagt

***************************************************************************

From lion@navier.stanford.edu Mon Aug 27 05:12:18 1990

I am responding to your recent posting on comp.text.tex. I have
written a scientific graphics program for the IBM PC called ProPLOT.
ProPLOT is a 2-D scientific graphics program.  It is command based,
that is you use commands like "set title bottom 'velocity'", etc., to
describe your plot.  Data can be read from a separate file, or they
may be placed in the same file as the commands.  Error bars, greek
text, log/linear axes, and (I think) most other scientific features
are included.  ProPLOT creates an Encapsulated PostScript file which
may be merged into TeX documents with the \special command.  We are
selling ProPLOT for $79 to students/faculty.  It is available from
Cogent Software, 1020 Pine St., Menlo Park, CA 94025, (415) 324-4360.
I can send you info if you send me your address.  We have sent an
evaluation copy of ProPLOT to the Ga Tech software evaluation lab.
You should be able to test it there.

Leo D. Eskin

**********************************************************************

From dfk@cs.duke.edu Mon Aug 27 09:20:48 1990

This does what you want, except for 3D plots.


                        ANNOUNCING GNUPLOT 2.0


What is Gnuplot 2.0?
--------------------

Gnuplot is a command-line driven interactive function plotting utility for
UNIX, MSDOS, and VMS platforms.  The software is free.  It was originally
intended as graphical program which would allow scientists and students
to visualize mathematical functions and data.  Additions to this version 
of the software allow production of publication quality plots and data graphs.
Gnuplot supports many different types of terminals, plotters, and printers 
and is easily extensible to include new devices.  [ The "GNU" in Gnuplot
has nothing to do with the Free Software Foundation, the naming is just
a coincidence (and a long story). ]


Gnuplot Features:
  Free!
  Cartesian and Polar plots.
  Logscale graphs.
  Intelligent Tic spacing.
  Optional Autoscaling.
  Support for complex numbers.
  VMS-like online help.
  User-definable functions and variables.
  All the builtin functions C, FORTRAN, and BASIC provide.
  All the unary and binary operators supported by C, and more.
  MANY formatting features, such as labels, grids, and arrows.
  Support for Saving and Loading work in progress.
  Command line substitution.
  And lots more....



Where to obtain Gnuplot 2.0
---------------------------

USENET users:

    comp.sources.misc should have it posted soon.


NORTH AMERICA:

     Anonymous ftp to duke.cs.duke.edu (128.109.140.1)
     Fetch pub/gnuplot.tar.Z in binary mode.

     Users without ftp capability can obtain it through a mail ftp
     server. Send a mail message saying 'help' to
     BITFTP@pucc.princeton.edu for instructions. For a uuencoded
     copy of the gnuplot sources (compressed tar file), send this
     message to BITFTP@pucc.princeton.edu:
         FTP CS.DUKE.EDU UUENCODE
         USER ANONYMOUS
         CD pub
         BINARY
         GET gnuplot.tar.Z
         QUIT


US MAIL:

    If you can't obtain Gnuplot 2.0 through any of the described
    channels I will mail copies on IBM PC floppies.  You must send
    a SELF-ADDRESSED STAMPED DISK MAILER with the correct number
    of FORMATTED DISKS and a description size of format of the
    disks you want returned (in case the disks get separated from the 
    mailer).  Send 1 1.2M 5.25 disk or 1 720K or 1.44M 3.5 disk, or
    2 360K 5.25 disks.  Turn around time may be slow. Send materials to:

            GNUPLOT
            48 Lyford Drive  #8
            Tiburon, CA 94920 
            attn: Thomas Williams


AUSTRALIA:

     Anonymous ftp to monu1.cc.monash.edu.au (130.194.1.101). 
     Fetch pub/gnuplot.tar.Z in binary mode.


EUROPE:

     Gnuplot will be stored in [tex-archive.gnuplot] at uk.ac.aston.tex
  
  JANET users
     FTP access is available (I regret no interactive access at present)
     Site        uk.ac.aston.tex
     Username    public
     password    public
     top level   tex-archive
  
  MAIL access
     Send a message to texserver@uk.ac.aston.tex
  
     The message body must contain at least the following three lines 
     starting in column 1. 
  
        ---
        (your address from Aston  - see the end of this message)
        help
  
     Return Addressing:
     Internet users    name%site@nsfnet-relay
     Bitnet and EARN   name%site@earn-relay
     UUCP              name%site@ukc
----


	 DISCLAIMER - This product is not related in any way to 
     Pixar or any other commercial venture.

     Please send any questions or comments to pixar!info-gnuplot.


                                        -Thomas Williams-


*****************************************************************************

From templon@copper.ucs.indiana.edu Mon Aug 27 20:36:30 1990

Hi,

	I asked some similar questions a while back, so here are some of
the things I learned.

	First, you should take a look at GNUPlot.  This is a program available
by anonymous ftp from prep.ai.mit.edu file pub/gnu/gnuplot-2.0.tar.Z I think.
It will run under unix, VMS and MS-DOS.  It does many scientific graphing
tasks (I am not sure about the particular logarithmic things you asked, but
I think it does standard log plotting (you specify "set axis y log" or
something and it does the rest)).  One thing I found lacking was support for
what we call "error bars" which reflect the precision with which data has been
measured.  But the nice thing about it is that you are in control of much of
the plotting format, and you can set it up on the screen first (it supports
many graphic standards, such as TEK40XX, postscript, IBM (EGA or VGA or
whateverGA), Imagen, and several others I had never heard of) and then type
SET TERM LATEX and REPLOT and bingo!  The output comes out in LaTeX "picture"
mode format so you just include the output in your TeX source code and run
TeX on it.  Of course if you wanted to you could make a postscript output
("set term postscript") and include it via \special.  It comes with two
manuals, one for general operation and one with tips specifically for use
with LaTeX.

	The other drawback, I forgot to mention, with GNUPlot is that you
can make LaTeX run out of memory pretty quickly with GNUPlot although I
understand that PiCTeX is much worse in this respect.

	Another thing you might want to check out is EPIC and EEPIC.  They
probably will not do what you want in terms of the logarithmic stuff,
but they do look to be useful for including diagrams or very simple graphs
into the LaTeX code.  They are enhancements over standard LaTeX "picture"
mode.  GNUPlot has an experimental driver for EEPIC which is supposed
to remedy some of the memory problems when TeXing.  EEPIC can give really
nice graphics when your dvi driver supports tpic \specials but still is
supposedly an improvement over "picture" if you don't support the tpic
stuff.  There are nice manuals for these too.  I have these packages on
disk and could send them if you want.

	One option that you could use if postscript is sufficient is the
program TOPDRAWER which originated at Stanford.  We use an old (1986) version
here and it may be even better by now, it is a very powerful graphics
program with spline curves drawn through points, error bars, 3-D plotting
(actually a separate program TD3D by the same people), fancy labels, control
over axes, ticks, formats, etc.  There are some other programs from TRIUMF
which are similar and used here quite heavily but I can't comment since I
don't use them.  I can give you the email address of someone to contact
at TRIUMF if you are interested in their package, and I could find out who
to talk to at Stanford.  I don't know if postscript is a supported graphics
output device for the TRIUMF packages but it is for the one from Stanford.

	Good luck and feel free to contact me.

					Jeff Templon

**************************************************************************

From charlie@milton.u.washington.edu Tue Aug 28 00:16:02 1990

I don't know whether you want this much, but S, the statistical computing
environment from AT&T Bell Labs does all this and much more.  The output
is PostScript, not dvi, but this can easily be incorporated in TeX output
if you have a dvi*ps that supports psfig, and a little less easily (but
not really hard, we do it here) if you have a dumber dvi*ps.

Of course we have S to do statistics in, but it makes really nice plots.

************************************************************************

From jensting%skinfaxe.diku.dk@dkuug.dk Tue Aug 28 05:03:40 1990

Since non of the follow-ups mentioned it, I'll plug for GNUPLOT 2. It
drives many usaul UN*X terminals (including X11), and provides LaTeX
graph data output.

Available for FTP from a lot of sites, I guess.

	Jens

********************************************************************
From cantrell@eemips.tamu.edu Tue Aug 28 10:57:37 1990

We conducted a fairly extensive search a couple of years ago.
The only unique thing we were looking for was that the package had
to run under both unix and vms. The package we selected
was PGPLOT from T. J. Pearson at CalTech.

We have made local additions that allow you to create TeX fonts
from PGPLOT output which can then be placed in a TeX/LaTeX
document. Because the giant fonts made by some graphs
broke the dvi driver, we also made mods to Nelson Beebe's
laserjet driver. PGPLOT also generates PostScript output,
and drives a wide array of other output devices including
Tek, vt125, Sun's, etc.

We are happy with this system, and eveyone in EE uses it.
We are, however, also pursuing a PostScript solution.
Many of the faculty and students want to do their plots
on a Mac or a PC and then be able to include them in
TeX documents. We are running the psfig macros and
dvips which support this kind of graphics inclusion.

If you want more information you can send mail to
forrest@ee.tamu.edu, he made the modifications
to PGPLOT.

************************************************************************

From rdkeys@ccvr1.cc.ncsu.edu Tue Aug 28 14:20:50 1990

How about GnuPlot 2.0?

I use it occasionally, and it works well, except for not being able to
rotate a vertical axis (due to non-postscript printers here).

R.D. Keys, rdkeys@ccvr1.cc.ncsu.edu

***************************************************************************

From palmerp@MATH.ORST.EDU Tue Aug 28 23:44:45 1990

There is a PD program called GNUPLOT which supports tex/latex output.
You can write prograns in gnuplot, display results on a (graphics) terminal,
and generate latex code from the output. Write

To: pixar!info-gnuplot@Sun.COM


for more info.

Paul Palmer

***************************************************************************

From hrp@pecan.cray.com Thu Aug 30 18:34:29 1990

I know of two such packages, both freely available:  xgraph and
gnuplot.  Both produce PostScript among other output formats,
including on-screen preview.  Look for the basic gnuplot distribution
on prep.ai.mit.edu in pub/gnu/gnuplot2.0.tar.Z.  An X11 previewer is
on expo.lcs.mit.edu in contrib/gnuplot-2.0-X11.tar.Z.  Xgraph is on
uunet.uu.net in comp.sources.unix/volume3/xgraph, but that version may
be out of date; ask the author for updates.

Hal Peterson			Domain:  hrp@cray.com

***************************************************************************

From cognos!garym Fri Aug 31 21:16:54 1990

Try GNU-PLOT, available from Clarkson or SIMTEL.  I've not tried its
TeX output, but the docs claim it will.

Gary Murphy                   uunet!mitel!sce!cognos!garym

***************************************************************************

From sondeen@venera.isi.edu Fri Sep  7 21:29:04 1990

We use an extensive scientific math package called Mathlib, by Innosoft
(a spinoff of Claremont College, I believe); runs on Suns and Vaxen;
cost to universities is something like $300 for software and $300 for
manual; plots to zillions of devices and has (even color) postscript
outputs; has on-line (internet) user group for bugs, workarounds, etc.
Can't find the phone #; ask information for Innosoft Inc., Claremont, Ca.
/jeff

-- 
DAVIS,MARTIN HENRY JR
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{allegra,amd,hplabs,seismo,ut-ngp}!gatech!prism!gt4589b
ARPA: gt4589b@prism.gatech.edu

eln272v@monu1.cc.monash.oz ( r lang) (10/12/90)

In article <14998@hydra.gatech.EDU>, gt4589b@prism.gatech.EDU (Davis, Jr., Marti
n H.) writes:
> Summary of replies:
> From huffman@baepv1.ncsu.edu Sun Aug 26 23:10:19 1990
>
> I would recommend gnuplot (or xgnuplot, if you run X-windows).
> Sources are available via anonymous ftp from prep.ai.mit.edu,
>    pub/gnu/gnuplot2.0.tar.Z
> The xgnuplot wrapper is on expo.lcs.mit.edu in the contrib directory.
 
gnuplot 2.0 patch level 1 is available for anonymous ftp from cs.duke.edu
pub/gnuplot2.01.tar.Z.
 
This now includes an X-windows driver, so xgnuplot is not needed.
Fixes have been made to the LaTeX and EEPIC drivers, and a new
driver has been added for emTeX.
 
I was somewhat pleased to see the number of people using gnuplot!
-- 
Russell Lang   Email: rjl@monu1.cc.monash.edu.au   Phone: (03) 565 3460
Department of Electrical and Computer Systems Engineering
Monash University, Australia

grodan@cyklop.nada.kth.se (Mats G L|fdahl) (10/15/90)

Is there a way to use data files with several columns as input to
gnuplot?

Our data is typically in files where the first column should be used for
x-coordinates, while the other columns are functions of x. We want to
be able to specify what columns should be plotted.

I've just installed GNUPLOT (v2.0) and read through the manual. It
looks quite OK and I'm trying to decide whether to replace our old plot
program.

--
Mats L|fdahl           Stockholm Observatory         tel +46-8 16 44 75
Lofdahl@Astro.SU.SE