Gnuplot.py on SourceForge Logo

Quick links:

Intro

Gnuplot.py is a Python package that interfaces to gnuplot, the popular open-source plotting program. It allows you to use gnuplot from within Python to plot arrays of data from memory, data files, or mathematical functions. If you use Python to perform computations or as 'glue' for numerical programs, you can use this package to plot data on the fly as they are computed. And the combination with Python makes it is easy to automate things, including to create crude 'animations' by plotting different datasets one after another.

Commands are communicated to gnuplot through a pipe and data either through the same pipe (as "inline" data), through FIFOs (named pipes), or through temporary files. It has been developed under Unix and is known to work under various forms of Unix (including Linux), MS Windows, MacOS, and Mac OS X. There is now also preliminary support for running Gnuplot.py under Jython/Java.

This package has an object-oriented design that allows the user flexibility to set plot options and to run multiple gnuplot sessions simultaneously. If you are more ambitious, it is not difficult to add entirely new types of plottable items by deriving from the 'PlotItem' class.

The package includes a demonstration that can be run by typing 'python demo.py'.

News

(2 May 2008) Gnuplot.py version 1.8 is out. This version includes bugfixes and improvements that have piled up since 1.7, including compatibility with NumPy. For more information, read the NEWS.txt file in the distribution.

(17 October 2003) Gnuplot.py version 1.7 is out. This version includes a change of license from GPL to LGPL, support for sending data to Gnuplot via FIFOs (named pipes) under unix, and preliminary support for running Gnuplot.py under Jython. For more information, read the NEWS.txt file in the distribution.

Documentation

The quickest way to learn how to use Gnuplot.py is to install it then run the simple demonstration by typing 'python demo.py', then to look at the demo.py file to see the commands that create the demo. One of the examples is probably similar to what you want to do.

Don't forget to read the Gnuplot.html, README.txt and FAQ.txt files in the Gnuplot.py distribution.

HTML documentation for the Python classes is included in the doc/ directory of the distribution and is also available online. This documentation is extracted automatically from the package's docstrings using happydoc and is known to have some formatting problems. Alternatively, you can look at the docstrings yourself by opening the python files in an editor.

Finally, there is a mailing list for Gnuplot.py users. For more information about subscribing to the list or viewing the archive of old articles, please click here.

To get good use out of Gnuplot.py, you will want to know something about gnuplot, for which a good source is the gnuplot help (run gnuplot then type 'help', or read it online at the gnuplot website).

Installation

More detailed installation instructions are contained in README.txt.

Before you can use Gnuplot.py, you will need working versions of

If you want to run under MS Windows, make sure you have pgnuplot.exe (see the README.txt file for details).

To install Gnuplot.py:

  1. Download either gnuplot-py-1.8.tar.gz or Gnuplot-1.8.zip.
  2. Gunzip and untar (or unzip) it, which will create a directory called gnuplot-1.8.
  3. Refer to README.txt in that directory for further instructions. Usually it should be enough to type python setup.py install.

You can also access the latest Gnuplot.py sources via Subversion. Click here for more information.

Copyleft

Gnuplot.py is released under the GNU Lesser General Public License, which means that it can be freely copied and used, but that there are some restrictions on your rights to incorporate it into commercial products. See the LICENCE file for more information. (If these restrictions are a problem for you, please contact me to discuss the issue.)

Credits

The Gnuplot.py package was written by Michael Haggerty.

The package was inspired by and partly derived from the Gnuplot.py module written by Konrad Hinsen.

Berthold Höllmann submitted a setup.py file to be used with distutils.

Craig Schardt and Francois Ladouceur contributed changes that enable Gnuplot.py to work under MS-Windows. Tony Ingraldi contributed changes for the Macintosh.

Jannie Hofmeyr submitted a fix for Windows under Python 2.0.

Matthew Fulmer contributed a patch to add the filename argument to Data and GridData.

Thanks also to many other users who have submitted suggestions, bug fixes, and other feedback.


Written by Michael Haggerty (email <mhagger@alum.mit.edu>)