pyglplot
pyglplot is a program to 3D-plot mathematical functions and
datafiles. It is written as a module for python and as such features
the full power and flexibility of the
python programming language.
The graphics is implemented using OpenGL and the Gimp Toolkit for X11.
Features
- Data Sources
- Plot python functions
- Plot python dictionaries containing the coordinates of the points and their position in the grid
- Plot plain datafiles as understood for example by gnuplot
- Graphics
- Can make 3D plots of surfaces in normal or parametric mode
- Support coordinate transforms, i.e. can make e.g. polar plots
- Support for pm3d-style coloring of the surface
- Support for wireframe plotting atop of the surface
- Support for transparency: translucent plots
- Support for different types of fog and arbitrary background colors
- Support for dynamic light and specular reflexes etc.
- Use either perspective projection or parallel projection
- Save the rendered plots as portable network graphics (.png)
- Adjust all graphics parameters via dialog windows
- Platforms
- This program is developed and tested on Max OS X 10.4 on powerpc with fink and Debian GNU/Linux on i386. It should compile and run everywhere where its prerequisites and requisites thereof are available. These are
gtkglext-1.0 and gthread-2.0. Some minimum versions of the libriaries must be met, unfortunately, the gtk+-2.2 packages provided by fink for Mac OS X 10.3 are not sufficient -- perhaps I will port it there.
- Coming soon (already implemented in the backend, not yet in the python interface):
- Plot C functions from a shared library
- Make plots of vector fields, either with plain arrows, or spatial objects
Pictures
First, I want to present a screenshot how the pyglplot user interface looks like:

Here you see the user interface of pyglplot. It consists of a
terminal where python is running, a main OpenGL window with a
menu, a main control dialog to setup some global OpenGL
parameters, and a so-called DataSet control dialog to set up
options that are specific to the dataset. Also shown is the
a color selection dialog that allows you to change the color
of the wireframe grid of your plot.
You see pyglplot also runs on Mac OS X with Apple's X11.
Plans for a native Aqua port do exist.
Now follow some saved plots from pyglplot:
|
The sinc(x)=sin(x)/x function plotted as a function of the modulus of the coordinates (x,y).
>>> plot(lambda x,y: 3*sinc(norm(x,y)), xrange=(-10,10), yrange=(-10,10))
|
|
The same plot with different background and wireframe color.
>>> plot(lambda x,y: 3*sinc(norm(x,y)), xrange=(-10,10), yrange=(-10,10))
|
|
The same function, plotted in polar coordinates.
>>> plot(lambda r,phi: 3*sinc(r), trans=Polar(), \
... size=(49,49), xrange=(0,10), yrange=(0,2*math.pi))
|
|
The sinc plot again. A fully translucent surface (alpha=0.0) gives a pure wireframe plot.
|
|
Surface color is set to white and alpha to 1.0 -- we get a "remove hidden lines" effect.
|
|
The same plot again, but with an intermediate alpha of 0.7 gives some transparency.
|
|
A sphere. This demonstrates the capability of pyglplot to
create parametrical plots.
>>> plot(lambda phi,theta: [2*math.sin(phi)*math.cos(theta), \
... math.sin(phi)*math.sin(theta),math.cos(phi)], \
... xrange=(0,math.pi), yrange=(0,2*math.pi), size=(49,49), \
... parametric=True)
|
Documentation
Download
- Current version: 0.1.0, released on 2005-07-23
Contact the
author.