Module pygplot
[show private | hide private]
[frames | no frames]

Module pygplot

Pygplot: A Python Interface to Pgplot

Version: 0.92

Author: Chris Burns

Requires:

Pgplot (http://www.astro.caltech.edu/~tjp/pgplot/)

You can get the source for pygplot here: http://astro.swarthmore.edu/~burns/pygplot_downloads.

There is the beginnings of a manual here: http://astro.swarthmore.edu/~burns/pygplot.pdf.

This python module provides an object-oriented interface to the Pgplot library of routines. Most (though not all) of the functionality of Pgplot is included:
  1. 1-D plots using lines, symbols and error-bars
  2. 2-D plots using color (or gray-scale) images and contours
  3. Access to all the pgplot primitives through the ppgplot extension module.

Classes
MPlot Class used to create a multi-panel plot with separate bounding boxes.
Panel Class used to create a multi-panel plot with a single bounding box.
Plot Class to make a single 2-D plot.
_Axis A class used by the Plot class.
_ColorPoint Class used to display (x,y) points (like _Point), but each point is colored differently, depending on the value of a third array (z).
_Contour Class used to plot a contour of data.
_ErrorBar A class used by the Plot class to store information about drawing errorbars
_Hist Class used by Plot to make a Histogram.
_Image Class used to display an image representation of data.
_Label A class used by the Plot class.
_Layout A class that handles the page layout of the graph.
_Legend A class used by the Plot class to make a legend.
_Line Class used by Plot and to store information about lines.
_Object An object in the plot.
_Palette  
_Point Class used by Plot to store information about drawing points.

Function Summary
  box_range_select(x, y, key, inst, tol)
Select an x and y range simultaneously.
  close()
  columns(filename, skip, delim)
Read in the specified file and try to extract columns.
  Linear(low, high, n)
Convenience function for computing n numbers linearly interpolated between low and high.
  list_devices()
Print out the list of available devices.
  list_palettes()
Print the currently installed palettes to the terminal.
  load(file)
Load a previously saved plot instance from file.
  max_hack(array)
A quick hack to get around the fact that numarray doesn't have a function max, only a member function.
  min_hack(array)
ditto
  pan(x, y, key, inst)
Pan so that (x,y) is new center.
  pgspline(xp, yp, x, slope0, slope1)
Compute the cubic spline for a set of data
  plot(filename, using, with, skip, delim)
Convenience function to generate out a plot instance using columnar data from filename, using columns specified in using (a list of 2-tuples, one for each data line).
  printcoords(x, y, key, inst)
  redraw(x, y, key, inst)
  replot()
  save(instance, file)
Save a plot instance in file.
  set(option, value)
  xrange_select(x, y, key, inst, tol)
Select an xrange.
  yrange_select(x, y, key, inst, tol)
Select a yrange.
  zoom(x, y, key, inst)
Zoom in or out by 50%.
  _evspline(xp, x, c0, c1, c2, c3)
  _scalerange(data)
Adjust the range to be plotted so that it fits nicely on the page.
  _set_color(color)
  _spline(x, c0, c1, c2, c3)

Variable Summary
dict descriptions = {'/NULL': ['(Null device, no output)', 0]...
list devices = ['/GIF', '/VGIF', '/NULL', '/PPM', '/VPPM', '/...
SRE_Pattern hex_pat = ([A-Z0-9]{2})([A-Z0-9]{2})([A-Z0-9]{2})
str module = 'Numeric'
int n_devices = 14                                                                    
dict _color_table = {'Blue': 4, 'Pink': 13, 'Green3': 10, 'Gr...
NoneType _data = None                                                                  
str _default_clab_color = 'white'
int _default_clab_int = 40                                                                    
int _default_clab_min = 10                                                                    
str _default_color = 'white'
int _default_font = 1                                                                     
float _default_fsize = 1.0                                                                   
int _default_linestyle = 1                                                                     
int _default_linewidth = 1                                                                     
int _default_lw = 2                                                                     
str _default_palette = 'real'
int _default_symbol = 1                                                                     
str _default_transfer = 'linear'
_Palette _pgpalette = <pygplot._Palette instance at 0x717530>
NoneType _plot = None                                                                  

Function Details

box_range_select(x, y, key, inst, tol=1.0000000000000001e-05)

Select an x and y range simultaneously.

columns(filename, skip=[], delim=None)

Read in the specified file and try to extract columns. So far, it will recognise space-, comma-, tab-, or semi-colon-delimited columns. Columns are numbered from 0.
Parameters:
filename - the name of the file to read
           (type=string)
skip - List of lines to skip (besides lines commented with '#')
           (type=list of integers)
delim - Specify the delimeter explicitly
           (type=string)
Returns:
a 2-D array: one row for each column in the file

Linear(low, high, n)

Convenience function for computing n numbers linearly interpolated between low and high. Used as the default function for the cfunc parameter to the contour function.

list_devices()

Print out the list of available devices.

list_palettes()

Print the currently installed palettes to the terminal.

load(file)

Load a previously saved plot instance from file.

max_hack(array)

A quick hack to get around the fact that numarray doesn't have a function max, only a member function.

min_hack(array)

ditto

pan(x, y, key, inst)

Pan so that (x,y) is new center.

pgspline(xp, yp, x, slope0=None, slope1=None)

Compute the cubic spline for a set of data
Parameters:
xp - An array of x-coordinates for the control points.
           (type=float array)
yp - An array of y-coordinates for the control points.
           (type=float array)
x - An array of x-coordinates where you want interpolations to be done
           (type=float array)
slope0 - Optionally specify the slope at the beginning of the interval
           (type=float)
slope1 - Optionally specify the slope at the end of the interval
           (type=float)

plot(filename, using=[0, 1], with=['l', 'p'], skip=[], delim=None)

Convenience function to generate out a plot instance using columnar data from filename, using columns specified in using (a list of 2-tuples, one for each data line).

save(instance, file)

Save a plot instance in file. This uses python's pickle module.

xrange_select(x, y, key, inst, tol=1.0000000000000001e-05)

Select an xrange.

yrange_select(x, y, key, inst, tol=1.0000000000000001e-05)

Select a yrange.

zoom(x, y, key, inst)

Zoom in or out by 50%.

_scalerange(data)

Adjust the range to be plotted so that it fits nicely on the page. Return a list with adjusted minimum and maximum values from 'data'.

Variable Details

descriptions

Type:
dict
Value:
{'/AQT': ['(AqauTerm.app under Mac OS X)', 1],
 '/CPS': ['(Colour PostScript file, landscape orientation)', 0],
 '/GIF': ['(Graphics Interchange Format file, landscape orientation)',\
 0],
 '/NULL': ['(Null device, no output)', 0],
 '/PPM': ['(Portable Pixel Map file, landscape orientation)', 0],
 '/PS': ['(PostScript file, landscape orientation)', 0],
 '/VCPS': ['(Colour PostScript file, portrait orientation)', 0],
...                                                                    

devices

Type:
list
Value:
['/GIF', '/VGIF', '/NULL', '/PPM', '/VPPM', '/PS', '/VPS', '/CPS', '/V\
CPS']                                                                  

hex_pat

Type:
SRE_Pattern
Value:
([A-Z0-9]{2})([A-Z0-9]{2})([A-Z0-9]{2})                                

module

Type:
str
Value:
'Numeric'                                                              

n_devices

Type:
int
Value:
14                                                                    

_color_table

Type:
dict
Value:
{'BLACK': 0,
 'BLUE': 4,
 'BLUE2': 11,
 'Black': 0,
 'Blue': 4,
 'Blue2': 14,
 'CYAN': 5,
 'Cyan': 5,
...                                                                    

_data

Type:
NoneType
Value:
None                                                                  

_default_clab_color

Type:
str
Value:
'white'                                                                

_default_clab_int

Type:
int
Value:
40                                                                    

_default_clab_min

Type:
int
Value:
10                                                                    

_default_color

Type:
str
Value:
'white'                                                                

_default_font

Type:
int
Value:
1                                                                     

_default_fsize

Type:
float
Value:
1.0                                                                   

_default_linestyle

Type:
int
Value:
1                                                                     

_default_linewidth

Type:
int
Value:
1                                                                     

_default_lw

Type:
int
Value:
2                                                                     

_default_palette

Type:
str
Value:
'real'                                                                 

_default_symbol

Type:
int
Value:
1                                                                     

_default_transfer

Type:
str
Value:
'linear'                                                               

_pgpalette

Type:
_Palette
Value:
<pygplot._Palette instance at 0x717530>                                

_plot

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.1 on Tue Sep 25 12:14:22 2007 http://epydoc.sf.net