Home | Trees | Index | Help |
---|
Module pygplot :: Class Plot |
|
Class to make a single 2-D plot. Use this class to produce a single frame plot, with axes, lines, points, etc. See constructor for options.
Example:
>>> plot = Pgplot.Plot(device='test.ps/PS', xrange=[0,1], yrange=[0,10])
>>> plot.point(x,y)
>>> plot.line(x,y)
>>> plot.plot()
>>> plot.close()
Method Summary | |
---|---|
Initialization routine. | |
__getattr__(self,
name)
| |
__setattr__(self,
name,
value)
| |
__str__(self)
| |
Add an alternate axis to the plot. | |
Draw a box with lower left corner (xll,yll) and upper-right corder (xur,yur) in world coordinates. | |
Draw a circle centered on (x,y) with radius r, all in world coordinates. | |
Close the plot device. | |
Add a data set that will be drawn with symbols. | |
Contour plot data. | |
Draw an ellipse centered on (x,y) with major axis and minor axis, rotated by pa (degrees). | |
Add error bars to the data points. | |
Get the current window range of the graph. | |
Plot a histogram of unbinned data. | |
Plot a grey-scale or color image representation of data on the background of the plot. | |
Select the plots device, and enter an interactive loop. | |
Add a label to the plot. | |
Draw a legend for the data. | |
Add a data set that are connected with lines | |
Plot the plot object. | |
Add a data set that will be drawn with symbols. | |
Select the plot's device, erase and redraw the plot. | |
This will make the instance's device the selected device (and make it's panel the current pane if it is part of an Mplot or Panel). | |
Converts the (u,v) pair to world coordinates. | |
Converts the (x,y) pair to normalized device coordinates. |
Method Details |
---|
__init__(self,
**kw)
Initialization routine. The Plot class has the following options
which can be specified:
|
axis(self, x1, y1, x2, y2, v1, v2, log=0, label=0, dec=0, exp=0, step=0, nsub=0, dmajl=0.5, dmajr=0.5, fmin=0.5, disp=0.29999999999999999, orient=0.0, fsize=None, font=None, linestyle=None, linewidth=None, color=None)Add an alternate axis to the plot. This does not alter the viewport nor change the way points are plotted; it is merely a convenient way to add another axis.
|
box(self, xll, yll, xur, yur, linestyle=None, color=None)Draw a box with lower left corner (xll,yll) and upper-right corder (xur,yur) in world coordinates. |
circle(self, x, y, rad, linestyle=None, color=None)Draw a circle centered on (x,y) with radius r, all in world coordinates. |
close(self)Close the plot device. Only effective if the Plot instance is not part of a MPlot or Panel instance. |
color_point(self, x, y, z, symbol=None, size=None, palette='real', transfer='linear', linewidth=None)Add a data set that will be drawn with symbols. Unlike the usual point, here the value of z is used to determine an intensity of each point and, based on the chosen palette, this is drawn with differen colors.
|
contour(self, data, **kw)Contour plot data. The only required argument is a 2 dimensional array. The rest of the arguments are as follows:
|
ellipse(self, x, y, major, minor, pa, linestyle=None, color=None, n=100)Draw an ellipse centered on (x,y) with major axis and minor axis, rotated by pa (degrees). |
error(self, x, y, dx1=None, dy1=None, dx2=None, dy2=None, linestyle=None, length=1, linewidth=None, color=None)Add error bars to the data points. By specifying one or two error limits, you get symmetric or non-symmetric error bars, respectively.
|
get_range(self)Get the current window range of the graph. |
histogram(self, data, **kw)Plot a histogram of unbinned data. The bins are computed automatically by the routine from the input data. The other optional arguments are
|
image(self, data, **kw)Plot a grey-scale or color image representation of data on the background of the plot. The only required argument is data, a 2 dimensional array. The other options are as follows:
|
interact(self, bindings=None, mode=7)Select the plots device, and enter an interactive loop. Default bindings include: "z,Z": zoom in, zoom out "A": (left click) print coordinates "X": (right click) re-center "r": redraw 'x': select xrange 'y': select yrange 'b': select x and y range (box) make new bindings (or override existing ones) with the bindings keyword. The only one you can't override is 'q', to quite the interactive session. It is a dictionary, each key representing a key-press. The associated data should be a function accepting the parameters x,y,key,plot where x and y are the coordinates, key is the key pressed and plot is the instance of the plot. |
label(self, x, y, string, angle=0, just=0, fsize=None, font=None, color=None, width=None, vjust=0, bbox=None, reference='absolute', linewidth=None)Add a label to the plot.
|
legend(self, height=None, width=None, position='ur', dx=None, dy=None, bbox=None, fsize=None, font=None, color=None, linewidth=None)Draw a legend for the data. You can control the height of the bounding box in world coordinates if you want to, but that will over-ride the font size (fsize has no effect). The position can be ur (upper right), lr (lower right), ul (upper left), or ll (lower left). dx and dy allow you to offset the legend from the axis (positive number brings it inside the graph). If bbox is not None, a bounding box will be drawn.
|
line(self, x, y, linestyle=None, linewidth=None, color=None, label=None)Add a data set that are connected with lines
|
plot(self, just=0)Plot the plot object. This is called if the Plot instance is not part of a MPlot or Panel. Otherwise, MPlot or Panel will be responsible for calling it. The optional just parameter is used internally. |
point(self, x, y, symbol=None, size=None, color=None, label=None, linewidth=None)Add a data set that will be drawn with symbols.
|
replot(self)Select the plot's device, erase and redraw the plot. Use this in the interactive mode to make changes and replot. |
select(self)This will make the instance's device the selected device (and make it's panel the current pane if it is part of an Mplot or Panel). All ppgplot raw commands will then be directed to this plot. |
vp2world(self, u, v)Converts the (u,v) pair to world coordinates. The viewport and window must be setup (i.e., plot() must have been called). |
world2vp(self, x, y)Converts the (x,y) pair to normalized device coordinates. The viewport and window must be setup (i.e., plot() must have been called). |
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Tue Sep 25 12:14:23 2007 | http://epydoc.sf.net |