[MATRIX-SIG] The Python interface to PGPLOT graphics library

Nick Patavalis npat@ariadne.di.uoa.gr
Fri, 6 Feb 1998 16:23:10 +0200 (EET)



A PYTHON / NUMERIC-PYTHON INTERFACE TO THE PGPLOT 
GRAPHICS LIBRARY.


One thing I found missing from Python and Numeric Python was a good
library-of-functions (module) specially designed for scientific
visualization (as opposed to imaging or GUI implementation). I know
there is at least one interface to Gnuplot, and other interfaces for
plotting through programs like Mathematica. They are a good
solution for simple tasks, and maybe even more. One has to admit,
though, that they lack the power (performance) and versatility
required for several more complex applications. This is true for a
number of reasons:

1. They provide their services through a different task, 
usually communicating via temporary files. This is not 
the most efficient architecture, and its also not free of other
problems.

2. Some of them are implemented as python scripts. Python
is nice, powerful and easy to use, but it lacks the 
performance of C.

3. The underlying programs that actually provide the graphics
capabilities are usually not general-purpose visualization 
tools but programs primarily designed for interactive use
(e.g. Gnuplot) 

In order to circumvent these limitations I decided to implement an
interface module that enables Numeric Python to call the functions of
the (really remarkable) PGPLOT graphics library. The interface module
is written in C and provides (or at least will do so soon) the full
set of PGPLOT facilities, wrapped in a python interface that resembles
as much as possible the original PGPLOT semantics and calling
conventions. I decided to do so in order to make life easier for those
who are already familiar with PGPLOT. I have also coded an
alternative interface for *some* PGPLOT functions that had a rather
"complicated" interface. These simplified interfaces are more close to
python's idiosyncrasies, and were designed to take advantage of some
of its special features (like optional arguments or keyword arguments,
etc).

After the original code is proven stable enough, I plan to implement
an even simpler interface. It will be designed for "interactive" use
(directly at the python prompt), but not only.  I think of making it
like Gnuplot's interface, (with a lot of functionality added). Anyway
I believe its too soon to say anything more on this subject.

I have NOT released the source code yet, but I plan to do so soon 
(maybe sometime in February). You can find some example screen-shots
produced by PPGPLOT in:

         http://ariadne.di.uoa.gr/ppgplot , 

along with the python code required to produce them.

For those of you who are not familiar with PGPLOT here's a short
description:

  PGPLOT is written by Tim Pearson

  The PGPLOT Graphics Subroutine Library is a Fortran- or C-callable,
  device-independent graphics package for making simple scientific
  graphs. It is intended for making graphical images of publication
  quality with minimum effort on the part of the user. For most
  applications, the program can be device-independent, and the output
  can be directed to the appropriate device at run time.

  The PGPLOT library consists of two major parts: a device-independent
  part and a set of device-dependent ``device handler'' subroutines for
  output on various terminals, image displays, dot-matrix printers,
  laser printers, and pen plotters. Common file formats supported
  include PostScript and GIF.

The home-page of pgplot is:

         http://astro.caltech.edu/~tjp/pgplot

The main thing missing from ppgplot is a decent build-system, usable
under many platforms and configurations. Any help on this would be
greatly appreciated.

Please send any comments/remarks or questions about the python interface
to pgplot (ppgplot) to:

         ppgplot@ariadne.di.uoa.gr

The amount of feedback I receive, will help me find out how many
people need this module, and adjust the development effort.

Regards

Nick Patavalis
University of Athens
npat@ariadne.di.uoa.gr
 

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________