Scientific plotting with Pygist

Updated November 26, 2012 Gist is a scientific graphics library written by David H. Munro of Lawrence Livermore National Laboratory. It produces x-vs-y plots, 2-D quadrilateral mesh plots with contours, filled contours, vector fields, or pseudocolor maps on such meshes. Some 3-D plot capabilities are also available. PyGist is the corresponding extension module for Python. PyGist is available for Linux/Unix, Mac OS X, Windows, and Cygwin. For Mac OS X, there is both a native version of Pygist and an X11 version. For the latter, you need to have X11 for Mac OS X; the native version uses Quartz directly.
For some screen shots, click here: sinus, histogram, cardioids, colors, cellarray, gist3d, sombrero. You can get a demonstration of the capabilities of Pygist by executing
>>> from gist import gistdemolow
>>> gistdemolow.run()
You can find more examples in gistdemo3d and gistdemomovie.
Some useful commands:
>>> from gist import * # to import the gist graphics package
>>> window() # to open the window where the plots will appear
>>> x = arange(100) * 0.1 # this uses the Numerical Python package
>>> y = sin(x)
>>> plg(y,x) # Now you should see a sine wave in the graphics window
# Note that y comes first (so that the x can be optional)
>>> fma() # frame advance to go to the next plot
>>> y = arange(10)
>>> plh(y) # to draw a histogram
Pygist allows you to make postscript files of the plots that you made:
>>> hcp_file('myplot.ps') # opens a postscript file called myplot.ps
>>> hcpon() # From now on, write the plot to the postscript file after each frame advance
>>> fma() # frame advance
>>> hcpoff() # Stop writing plots to the postscript file

Manual

Pygist has many more capabilities, check out the manual (HTML, PDF) if you want to know more. Also see the known bugs and issues.

Installation instructions:

  • For Cygwin/Linux/Unix/Mac OS X, the source distribution can be obtained using git:
    git clone http://portal.nersc.gov/project/warp/git/pygist.git

    Known bugs and issues:

    Running Pygist natively on Mac OS X

    The native version of Pygist on Mac OS X uses Quartz and can be run directly from a Terminal window. To use the native version, you first need to make sure that you are using a framework installation of Python, otherwise the Pygist graphics windows won't interact correctly with the Mac's windowing system. A framework Python can be installed by adding --enable-framework to the configure script that is run when installing Python from the source. With versions of Python older than 2.5, you should run pythonw instead of python for the graphics windows to work correctly. With Python 2.5 and later, this is not necessary; you can simply use python.
    To install Pygist, you will also need Numpy of course. Then, to install pygist, in the pygist directory run
    python setup.py config --cocoa
    python setup.py build --cocoa
    sudo python setup.py install --cocoa
    The first command will generate a lot of warnings and error messages. These are due to failed trial compilations and can be ignored. If you want to install the X11 version instead of the native Quartz version, then you can add --x11 to these commands (x11 is the default if no option is given).
    I built the native version of Pygist using version 10.3 of Mac OS X. Pygist should run with older versions also, except that the crosshair cursor is not available (you will get the usual arrow instead). If you have a single-button mouse, you can use the control and option key to simulate the other mouse buttons.

    License information:

    See the release notes for license information and disclaimer.