362 lines (298 with data), 27.4 kB
@header@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="matplotlib.html"><font color="#ffffff">matplotlib</font></a>.figure</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/lib/python2.3/site-packages/matplotlib/figure.py">/usr/local/lib/python2.3/site-packages/matplotlib/figure.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="matplotlib._image.html">matplotlib._image</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="matplotlib.artist.html#Artist">matplotlib.artist.Artist</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="matplotlib.figure.html#Figure">Figure</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Figure">class <strong>Figure</strong></a>(<a href="matplotlib.artist.html#Artist">matplotlib.artist.Artist</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Figure-__init__"><strong>__init__</strong></a>(self, figsize<font color="#909090">=None</font>, dpi<font color="#909090">=None</font>, facecolor<font color="#909090">=None</font>, edgecolor<font color="#909090">=None</font>, linewidth<font color="#909090">=1.0</font>, frameon<font color="#909090">=True</font>)</dt><dd><tt>paper size is a w,h tuple in inches<br>
DPI is dots per inch</tt></dd></dl>
<dl><dt><a name="Figure-add_axes"><strong>add_axes</strong></a>(self, *args, **kwargs)</dt><dd><tt>Add an a axes with axes rect [left, bottom, width, height] where all<br>
quantities are in fractions of figure width and height. kwargs are<br>
legal Axes kwargs plus"polar" which sets whether to create a polar axes<br>
<br>
<a href="#Figure-add_axes">add_axes</a>((l,b,w,h))<br>
<a href="#Figure-add_axes">add_axes</a>((l,b,w,h), frameon=False, axisbg='g')<br>
<a href="#Figure-add_axes">add_axes</a>((l,b,w,h), polar=True)<br>
<a href="#Figure-add_axes">add_axes</a>(ax) # add an Axes instance<br>
<br>
<br>
If the figure already has an axes with key *args, *kwargs then it will<br>
simply make that axes current and return it. If you do not want this<br>
behavior, eg you want to force the creation of a new axes, you must<br>
use a unique set of args and kwargs. The artist "label" attribute has<br>
been exposed for this purpose. Eg, if you want two axes that are<br>
otherwise identical to be added to the axes, make sure you give them<br>
unique labels:<br>
<br>
<a href="#Figure-add_axes">add_axes</a>((l,b,w,h), label='1')<br>
<a href="#Figure-add_axes">add_axes</a>((l,b,w,h), label='2')<br>
<br>
The Axes instance will be returned</tt></dd></dl>
<dl><dt><a name="Figure-add_axobserver"><strong>add_axobserver</strong></a>(self, func)</dt><dd><tt>whenever the axes state change, func(self) will be called</tt></dd></dl>
<dl><dt><a name="Figure-add_subplot"><strong>add_subplot</strong></a>(self, *args, **kwargs)</dt><dd><tt>Add an a subplot. Examples<br>
<br>
<a href="#Figure-add_subplot">add_subplot</a>(111)<br>
<a href="#Figure-add_subplot">add_subplot</a>(212, axisbg='r') # add subplot with red background<br>
<a href="#Figure-add_subplot">add_subplot</a>(111, polar=True) # add a polar subplot<br>
<a href="#Figure-add_subplot">add_subplot</a>(sub) # add Subplot instance sub<br>
<br>
kwargs are legal Axes kwargs plus"polar" which sets whether to create a<br>
polar axes. The Axes instance will be returned.<br>
<br>
If the figure already has a subplot with key *args, *kwargs then it will<br>
simply make that subplot current and return it</tt></dd></dl>
<dl><dt><a name="Figure-clear"><strong>clear</strong></a>(self)</dt><dd><tt>Clear the figure</tt></dd></dl>
<dl><dt><a name="Figure-clf"><strong>clf</strong></a>(self)</dt><dd><tt>Clear the figure</tt></dd></dl>
<dl><dt><a name="Figure-colorbar"><strong>colorbar</strong></a>(self, mappable, tickfmt<font color="#909090">='%1.1f'</font>, cax<font color="#909090">=None</font>, orientation<font color="#909090">='vertical'</font>)</dt><dd><tt>Create a colorbar for mappable image<br>
<br>
tickfmt is a format string to format the colorbar ticks<br>
<br>
cax is a colorbar axes instance in which the colorbar will be<br>
placed. If None, as default axesd will be created resizing the<br>
current aqxes to make room for it. If not None, the supplied axes<br>
will be used and the other axes positions will be unchanged.<br>
<br>
orientation is the colorbar orientation: one of 'vertical' | 'horizontal'<br>
return value is the colorbar axes instance</tt></dd></dl>
<dl><dt><a name="Figure-delaxes"><strong>delaxes</strong></a>(self, a)</dt><dd><tt>remove a from the figure and update the current axes</tt></dd></dl>
<dl><dt><a name="Figure-draw"><strong>draw</strong></a>(self, renderer)</dt><dd><tt>Render the figure using RendererGD instance renderer</tt></dd></dl>
<dl><dt><a name="Figure-figimage"><strong>figimage</strong></a>(self, X, xo<font color="#909090">=0</font>, yo<font color="#909090">=0</font>, alpha<font color="#909090">=1.0</font>, norm<font color="#909090">=None</font>, cmap<font color="#909090">=None</font>, vmin<font color="#909090">=None</font>, vmax<font color="#909090">=None</font>, origin<font color="#909090">=None</font>)</dt><dd><tt>FIGIMAGE(X) # add non-resampled array to figure<br>
<br>
FIGIMAGE(X, xo, yo) # with pixel offsets<br>
<br>
FIGIMAGE(X, **kwargs) # control interpolation ,scaling, etc<br>
<br>
Add a nonresampled figure to the figure from array X. xo and yo are<br>
offsets in pixels<br>
<br>
X must be a float array<br>
<br>
If X is MxN, assume luminance (grayscale)<br>
If X is MxNx3, assume RGB<br>
If X is MxNx4, assume RGBA<br>
<br>
The following kwargs are allowed: <br>
<br>
* cmap is a cm colormap instance, eg cm.jet. If None, default to<br>
the rc image.cmap valuex<br>
<br>
* norm is a matplotlib.colors.normalize instance; default is<br>
normalization(). This scales luminance -> 0-1<br>
<br>
* vmin and vmax are used to scale a luminance image to 0-1. If<br>
either is None, the min and max of the luminance values will be<br>
used. Note if you pass a norm instance, the settings for vmin and<br>
vmax will be ignored.<br>
<br>
* alpha = 1.0 : the alpha blending value<br>
<br>
* origin is either 'upper' or 'lower', which indicates where the [0,0]<br>
index of the array is in the upper left or lower left corner of<br>
the axes. Defaults to the rc image.origin value<br>
<br>
This complements the axes image (Axes.imshow) which will be resampled<br>
to fit the current axes. If you want a resampled image to fill the<br>
entire figure, you can define an Axes with size [0,1,0,1].<br>
<br>
A image.FigureImage instance is returned.</tt></dd></dl>
<dl><dt><a name="Figure-gca"><strong>gca</strong></a>(self, **kwargs)</dt><dd><tt>Return the current axes, creating one if necessary</tt></dd></dl>
<dl><dt><a name="Figure-get_axes"><strong>get_axes</strong></a>(self)</dt></dl>
<dl><dt><a name="Figure-get_dpi"><strong>get_dpi</strong></a>(self)</dt><dd><tt>Return the dpi as a float</tt></dd></dl>
<dl><dt><a name="Figure-get_edgecolor"><strong>get_edgecolor</strong></a>(self)</dt><dd><tt>Get the edge color of the <a href="#Figure">Figure</a> rectangle</tt></dd></dl>
<dl><dt><a name="Figure-get_facecolor"><strong>get_facecolor</strong></a>(self)</dt><dd><tt>Get the face color of the <a href="#Figure">Figure</a> rectangle</tt></dd></dl>
<dl><dt><a name="Figure-get_figheight"><strong>get_figheight</strong></a>(self)</dt><dd><tt>Return the figheight as a float</tt></dd></dl>
<dl><dt><a name="Figure-get_figwidth"><strong>get_figwidth</strong></a>(self)</dt><dd><tt>Return the figwidth as a float</tt></dd></dl>
<dl><dt><a name="Figure-get_frameon"><strong>get_frameon</strong></a>(self)</dt><dd><tt>get the boolean indicating frameon</tt></dd></dl>
<dl><dt><a name="Figure-get_size_inches"><strong>get_size_inches</strong></a>(self)</dt></dl>
<dl><dt><a name="Figure-get_width_height"><strong>get_width_height</strong></a>(self)</dt><dd><tt>return the figure width and height in pixels</tt></dd></dl>
<dl><dt><a name="Figure-hold"><strong>hold</strong></a>(self, b<font color="#909090">=None</font>)</dt><dd><tt>Set the hold state. If hold is None (default), toggle the<br>
hold state. Else set the hold state to boolean value b.<br>
<br>
Eg<br>
<a href="#Figure-hold">hold</a>() # toggle hold<br>
<a href="#Figure-hold">hold</a>(True) # hold is on<br>
<a href="#Figure-hold">hold</a>(False) # hold is off</tt></dd></dl>
<dl><dt><a name="Figure-legend"><strong>legend</strong></a>(self, handles, labels, loc, **kwargs)</dt><dd><tt>Place a legend in the figure. Labels are a sequence of<br>
strings, handles is a sequence of line or patch instances, and<br>
loc can be a string or an integer specifying the legend<br>
location<br>
<br>
USAGE: <br>
<a href="#Figure-legend">legend</a>( (line1, line2, line3),<br>
('label1', 'label2', 'label3'),<br>
'upper right')<br>
<br>
The LOC location codes are<br>
<br>
'best' : 0, (currently not supported, defaults to upper right)<br>
'upper right' : 1, (default)<br>
'upper left' : 2,<br>
'lower left' : 3,<br>
'lower right' : 4,<br>
'right' : 5,<br>
'center left' : 6,<br>
'center right' : 7,<br>
'lower center' : 8,<br>
'upper center' : 9,<br>
'center' : 10,<br>
<br>
loc can also be an (x,y) tuple in figure coords, which<br>
specifies the lower left of the legend box. figure coords are<br>
(0,0) is the left, bottom of the figure and 1,1 is the right,<br>
top.<br>
<br>
The legend instance is returned</tt></dd></dl>
<dl><dt><a name="Figure-savefig"><strong>savefig</strong></a>(self, *args, **kwargs)</dt><dd><tt>SAVEFIG(fname, dpi=150, facecolor='w', edgecolor='w',<br>
orientation='portrait'):<br>
<br>
Save the current figure to filename fname. dpi is the resolution<br>
in dots per inch.<br>
<br>
Output file types currently supported are jpeg and png and will be<br>
deduced by the extension to fname<br>
<br>
facecolor and edgecolor are the colors os the figure rectangle<br>
<br>
orientation is either 'landscape' or 'portrait' - not supported on<br>
all backends; currently only on postscript output.</tt></dd></dl>
<dl><dt><a name="Figure-sca"><strong>sca</strong></a>(self, a)</dt><dd><tt>Set the current axes to be a and return a</tt></dd></dl>
<dl><dt><a name="Figure-set_canvas"><strong>set_canvas</strong></a>(self, canvas)</dt><dd><tt>Set the canvas the contains the figure<br>
<br>
ACCEPTS: a FigureCanvas instance</tt></dd></dl>
<dl><dt><a name="Figure-set_dpi"><strong>set_dpi</strong></a>(self, val)</dt><dd><tt>Set the dots-per-inch of the figure<br>
<br>
ACCEPTS: float</tt></dd></dl>
<dl><dt><a name="Figure-set_edgecolor"><strong>set_edgecolor</strong></a>(self, color)</dt><dd><tt>Set the edge color of the <a href="#Figure">Figure</a> rectangle<br>
<br>
ACCEPTS: any matplotlib color - see help(colors)</tt></dd></dl>
<dl><dt><a name="Figure-set_facecolor"><strong>set_facecolor</strong></a>(self, color)</dt><dd><tt>Set the face color of the <a href="#Figure">Figure</a> rectangle<br>
<br>
ACCEPTS: any matplotlib color - see help(colors)</tt></dd></dl>
<dl><dt><a name="Figure-set_figheight"><strong>set_figheight</strong></a>(self, val)</dt><dd><tt>Set the height of the figure in inches<br>
<br>
ACCEPTS: float</tt></dd></dl>
<dl><dt><a name="Figure-set_figsize_inches"><strong>set_figsize_inches</strong></a>(self, *args)</dt><dd><tt>Set the figure size in inches<br>
<br>
Usage: <a href="#Figure-set_figsize_inches">set_figsize_inches</a>(self, w,h) OR<br>
<a href="#Figure-set_figsize_inches">set_figsize_inches</a>(self, (w,h) )<br>
<br>
ACCEPTS: a w,h tuple with w,h in inches</tt></dd></dl>
<dl><dt><a name="Figure-set_figwidth"><strong>set_figwidth</strong></a>(self, val)</dt><dd><tt>Set the width of the figure in inches<br>
<br>
ACCEPTS: float</tt></dd></dl>
<dl><dt><a name="Figure-set_frameon"><strong>set_frameon</strong></a>(self, b)</dt><dd><tt>Set whether the figure frame (background) is displayed or invisible<br>
<br>
ACCEPTS: boolean</tt></dd></dl>
<dl><dt><a name="Figure-text"><strong>text</strong></a>(self, x, y, s, *args, **kwargs)</dt><dd><tt>Add text to figure at location x,y (relative 0-1 coords) See<br>
the help for Axis text for the meaning of the other arguments</tt></dd></dl>
<hr>
Methods inherited from <a href="matplotlib.artist.html#Artist">matplotlib.artist.Artist</a>:<br>
<dl><dt><a name="Figure-add_callback"><strong>add_callback</strong></a>(self, func)</dt></dl>
<dl><dt><a name="Figure-get_alpha"><strong>get_alpha</strong></a>(self)</dt><dd><tt>Return the alpha value used for blending - not supported on all<br>
backends</tt></dd></dl>
<dl><dt><a name="Figure-get_clip_box"><strong>get_clip_box</strong></a>(self)</dt><dd><tt>Return artist clipbox</tt></dd></dl>
<dl><dt><a name="Figure-get_clip_on"><strong>get_clip_on</strong></a>(self)</dt><dd><tt>Return whether artist uses clipping</tt></dd></dl>
<dl><dt><a name="Figure-get_figure"><strong>get_figure</strong></a>(self)</dt><dd><tt>return the figure instance</tt></dd></dl>
<dl><dt><a name="Figure-get_label"><strong>get_label</strong></a>(self)</dt></dl>
<dl><dt><a name="Figure-get_transform"><strong>get_transform</strong></a>(self)</dt><dd><tt>return the Transformation instance used by this artist</tt></dd></dl>
<dl><dt><a name="Figure-get_visible"><strong>get_visible</strong></a>(self)</dt><dd><tt>return the artist's visiblity</tt></dd></dl>
<dl><dt><a name="Figure-get_zorder"><strong>get_zorder</strong></a>(self)</dt></dl>
<dl><dt><a name="Figure-is_figure_set"><strong>is_figure_set</strong></a>(self)</dt></dl>
<dl><dt><a name="Figure-is_transform_set"><strong>is_transform_set</strong></a>(self)</dt><dd><tt><a href="matplotlib.artist.html#Artist">Artist</a> has transform explicity let</tt></dd></dl>
<dl><dt><a name="Figure-pchanged"><strong>pchanged</strong></a>(self)</dt><dd><tt>fire event when property changed</tt></dd></dl>
<dl><dt><a name="Figure-remove_callback"><strong>remove_callback</strong></a>(self, oid)</dt></dl>
<dl><dt><a name="Figure-set_alpha"><strong>set_alpha</strong></a>(self, alpha)</dt><dd><tt>Set the alpha value used for blending - not supported on<br>
all backends<br>
<br>
ACCEPTS: float</tt></dd></dl>
<dl><dt><a name="Figure-set_clip_box"><strong>set_clip_box</strong></a>(self, clipbox)</dt><dd><tt>Set the artist's clip Bbox<br>
<br>
ACCEPTS: a matplotlib.transform.Bbox instance</tt></dd></dl>
<dl><dt><a name="Figure-set_clip_on"><strong>set_clip_on</strong></a>(self, b)</dt><dd><tt>Set whether artist uses clipping<br>
<br>
ACCEPTS: [True | False]</tt></dd></dl>
<dl><dt><a name="Figure-set_figure"><strong>set_figure</strong></a>(self, fig)</dt><dd><tt>Set the figure instance the artist belong to<br>
<br>
ACCEPTS: a matplotlib.figure.<a href="#Figure">Figure</a> instance</tt></dd></dl>
<dl><dt><a name="Figure-set_label"><strong>set_label</strong></a>(self, s)</dt><dd><tt>Set the line label to s for auto legend<br>
<br>
ACCEPTS: any string</tt></dd></dl>
<dl><dt><a name="Figure-set_lod"><strong>set_lod</strong></a>(self, on)</dt><dd><tt>Set Level of Detail on or off. If on, the artists may examine<br>
things like the pixel width of the axes and draw a subset of<br>
their contents accordingly<br>
<br>
ACCEPTS: [True | False]</tt></dd></dl>
<dl><dt><a name="Figure-set_transform"><strong>set_transform</strong></a>(self, t)</dt><dd><tt>set the Transformation instance used by this artist<br>
<br>
ACCEPTS: a matplotlib.transform transformation instance</tt></dd></dl>
<dl><dt><a name="Figure-set_visible"><strong>set_visible</strong></a>(self, b)</dt><dd><tt>set the artist's visiblity<br>
<br>
ACCEPTS: [True | False]</tt></dd></dl>
<dl><dt><a name="Figure-set_zorder"><strong>set_zorder</strong></a>(self, level)</dt><dd><tt>Set the zorder for the artist<br>
<br>
ACCEPTS: any number</tt></dd></dl>
<dl><dt><a name="Figure-update"><strong>update</strong></a>(self, props)</dt></dl>
<dl><dt><a name="Figure-update_from"><strong>update_from</strong></a>(self, other)</dt><dd><tt>copy properties from other to self</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.artist.html#Artist">matplotlib.artist.Artist</a>:<br>
<dl><dt><strong>aname</strong> = 'Artist'</dl>
<dl><dt><strong>zorder</strong> = 0</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-Bbox"><strong>Bbox</strong></a>(...)</dt><dd><tt><a href="#-Bbox">Bbox</a>(ll, ur)</tt></dd></dl>
<dl><dt><a name="-Point"><strong>Point</strong></a>(...)</dt><dd><tt><a href="#-Point">Point</a>(x, y)</tt></dd></dl>
<dl><dt><a name="-Value"><strong>Value</strong></a>(...)</dt><dd><tt><a href="#-Value">Value</a>(x)</tt></dd></dl>
<dl><dt><a name="-array"><strong>array</strong></a>(...)</dt><dd><tt><a href="#-array">array</a>(sequence, typecode=None, copy=1, savespace=0) will return a new array formed from the given (potentially nested) sequence with type given by typecode. If no typecode is given, then the type will be determined as the minimum type required to hold the objects in sequence. If copy is zero and sequence is already an array, a reference will be returned. If savespace is nonzero, the new array will maintain its precision in operations.</tt></dd></dl>
<dl><dt><a name="-figaspect"><strong>figaspect</strong></a>(arr)</dt><dd><tt>Determine the width and height for a figure that would fit array<br>
preserving aspcect ratio. The figure width, height in inches are<br>
returned. Be sure to create an axes with equal with and height, eg<br>
<br>
w, h = <a href="#-figaspect">figaspect</a>(A)<br>
fig = <a href="#Figure">Figure</a>(figsize=(w,h))<br>
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])<br>
ax.imshow(A, **kwargs)<br>
<br>
Thanks to Fernando Perez for this function</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>rcParams</strong> = {'axes.edgecolor': 'black', 'axes.facecolor': 'white', 'axes.grid': False, 'axes.hold': True, 'axes.labelcolor': 'black', 'axes.labelsize': 12.0, 'axes.linewidth': 1.0, 'axes.titlesize': 14.0, 'backend': 'WXAgg', 'datapath': '/usr/local/share/matplotlib', ...}</td></tr></table>
@footer@