[Top] [Prev] [Next] [Bottom]

1.1 Overview of the Python Graphics Interface

The Python Graphics Interface (abbreviated PyGraph) provides Python users with capabilities for plotting curves, meshes, surfaces, cell arrays, vector fields, and isosurface and plane cross sections of three dimensional meshes, with many options regarding line widths and styles, markings and labels, shading, contours, filled contours, coloring, etc. Animation, moving light sources, real-time rotation, etc., are also available. PyGraph is intended to supply a choice of easy-to-use interfaces to graphics which are relatively independent of the underlying graphics engine, concealing the technical details from all but the most intrepid users. Obviously different graphics engines offer different features, but the intention is that when a user requests a particular type of plot which is not available on a particular engine, the low level interface will make an intelligent guess and give some approximation of what was asked for.

There are two such graphics packages which are relatively independent of the underlying plotting library. The Object-Oriented Graphics (OOG) Package defines geometric objects (Curves, Surfaces, Meshes, etc.), Graph objects which can be given one or more geometric objects to plot, and Plotter objects, which receive geometric objects to plot from Graph objects, and which interface with the graphics engine(s) to do the actual plotting. A Graph can create its own Plotter, or the more capable user can create one or more, handy when one wishes (for instance) to plot on a remote machine, or to open graphics windows of different types at the same time. The second such package is called EZPLOT; it is built on top of OOG, and provides an interface similar to the command-line interface of the Basis EZN package. Some of our long-time users may be more comfortable with this package, until they have mastered the concepts of object-oriented design.

As mentioned above, a Graph object needs at least one Plotter object to plot itself; only the Plotter objects need know about graphics engines. At present we have two types of Plotter objects, one which knows about Gist and one which knows about Narcisse. Some power users may prefer to use the lower-level library-specific function calls, but most users will use EZPLOT or OOG.

Gist is a scientific graphics library written in C by David H. Munro of Lawrence Livermore National Laboratory. It features support for three common graphics output devices: Xwindows, (color) PostScript, and ANSI/ISO Standard Computer Graphics Metafiles (CGM). The library is small (written directly to Xlib), portable, efficient, and full-featured. It produces x-vs.-y plots with ``good'' tick marks and tick levels, 2-D quadrilateral mesh plots with contours, vector fields, or pseudocolor maps on such meshes. 3-D plot capabilities include wire mesh plots (transparent or opaque), shaded and colored surface plots, isosurface and plane cross sections of meshes containing data, and real-time animation (moving light sources and rotations). The Python Gist module gist.py and the associated Python extension gistCmodule provide a Python interface to this library (referred to as PyGist).

Narcisse is a graphics library developed at out sister laboratory at Limeil in France. It is especially strong in high-quality 3-D surface rendering. Surfaces can be colored in a variety of ways, including colored wire mesh, colored contours, filled contours, and colored surface cells. Some combinations of these are also possible. We have also added the capability of doing isosurfaces and plane sections of meshes, which is not available in the original Narcisse. The Python Narcisse module narcissemodule (referred to as PyNarcisse) provides a low-level Python interface to this library. Unlike Gist, Narcisse does not currently write automatically to standard files such as PostScript or CGM, although it writes profusely to its own type of files unless inhibited from doing so, as described below. However, there is a "Print" button in the Narcisse graphics window, which opens a dialog that allows you to write the current plot to a postscript file or to send it to a postscript printer.

[Top] [Prev] [Next] [Bottom]

Copyright © 1997,Regents of the University of California. All rights reserved.