349 lines (296 with data), 23.9 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>.widgets</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/lib/python2.4/site-packages/matplotlib/widgets.py">/usr/lib/python2.4/site-packages/matplotlib/widgets.py</a></font></td></tr></table>
<p><tt>GUI Neutral widgets<br>
<br>
All of these widgets require you to predefine an Axes instance and<br>
pass that as the first arg. matplotlib doesn't try to be too smart in<br>
layout -- you have to figure out how wide and tall you want your Axes<br>
to be to accommodate your widget.</tt></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="thread.html">thread</a><br>
</td><td width="25%" valign=top></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.widgets.html#Cursor">Cursor</a>
</font></dt><dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#HorizontalSpanSelector">HorizontalSpanSelector</a>
</font></dt><dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#Widget">Widget</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#Button">Button</a>
</font></dt><dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#CheckButtons">CheckButtons</a>
</font></dt><dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#RadioButtons">RadioButtons</a>
</font></dt><dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#Slider">Slider</a>
</font></dt><dt><font face="helvetica, arial"><a href="matplotlib.widgets.html#SubplotTool">SubplotTool</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="Button">class <strong>Button</strong></a>(<a href="matplotlib.widgets.html#Widget">Widget</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A GUI neutral button<br>
<br>
The following attributes are accesible<br>
<br>
ax - the Axes the button renders into<br>
label - a text.Text instance<br>
color - the color of the button when not hovering<br>
hovercolor - the color of the button when hovering<br>
<br>
Call "on_clicked" to connect to the button<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Button-__init__"><strong>__init__</strong></a>(self, ax, label, image<font color="#909090">=None</font>, color<font color="#909090">=0.84999999999999998</font>, hovercolor<font color="#909090">=0.94999999999999996</font>)</dt><dd><tt>ax is the Axes instance the button will be placed into<br>
<br>
label is a string which is the button text<br>
<br>
image if not None, is an image to place in the button -- can<br>
be any legal arg to imshow (array, matplotlib Image<br>
instance, or PIL image)<br>
<br>
color is the color of the button when not activated<br>
<br>
hovercolor is the color of the button when the mouse is over<br>
it</tt></dd></dl>
<dl><dt><a name="Button-disconnect"><strong>disconnect</strong></a>(self, cid)</dt><dd><tt>remove the observer with connection id cid</tt></dd></dl>
<dl><dt><a name="Button-on_clicked"><strong>on_clicked</strong></a>(self, func)</dt><dd><tt>When the button is clicked, call this func with event<br>
<br>
A connection id is returned which can be used to disconnect</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.widgets.html#Widget">Widget</a>:<br>
<dl><dt><strong>drawon</strong> = True</dl>
<dl><dt><strong>eventson</strong> = True</dl>
</td></tr></table> <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="CheckButtons">class <strong>CheckButtons</strong></a>(<a href="matplotlib.widgets.html#Widget">Widget</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A GUI neutral radio button<br>
<br>
The following attributes are exposed<br>
<br>
ax - the Axes instance the buttons are in<br>
labels - a list of text.Text instances<br>
lines - a list of (line1, line2) tuples for the x's in the check boxes.<br>
These lines exist for each box, but have set_visible(False) when<br>
box is not checked<br>
rectangles - a list of patch.Rectangle instances<br>
<br>
Connect to the <a href="#CheckButtons">CheckButtons</a> with the on_clicked method<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="CheckButtons-__init__"><strong>__init__</strong></a>(self, ax, labels, actives)</dt><dd><tt>Add check buttons to axes.Axes instance ax<br>
<br>
labels is a len(buttons) list of labels as strings<br>
<br>
actives is a len(buttons) list of booleans indicating whether<br>
the button is active</tt></dd></dl>
<dl><dt><a name="CheckButtons-disconnect"><strong>disconnect</strong></a>(self, cid)</dt><dd><tt>remove the observer with connection id cid</tt></dd></dl>
<dl><dt><a name="CheckButtons-on_clicked"><strong>on_clicked</strong></a>(self, func)</dt><dd><tt>When the button is clicked, call this func with button label<br>
<br>
A connection id is returned which can be used to disconnect</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.widgets.html#Widget">Widget</a>:<br>
<dl><dt><strong>drawon</strong> = True</dl>
<dl><dt><strong>eventson</strong> = True</dl>
</td></tr></table> <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="Cursor">class <strong>Cursor</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A horizontal and vertical line span the axes that and move with<br>
the pointer. You can turn off the hline or vline spectively with<br>
the attributes<br>
<br>
horizOn =True|False: controls visibility of the horizontal line<br>
vertOn =True|False: controls visibility of the horizontal line <br>
<br>
And the visibility of the cursor itself with visible attribute<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Cursor-__init__"><strong>__init__</strong></a>(self, ax, useblit<font color="#909090">=False</font>, **lineprops)</dt><dd><tt>Add a cursor to ax. If useblit=True, use the backend<br>
dependent blitting features for faster updates (GTKAgg only<br>
now). lineprops is a dictionary of line properties. See<br>
examples/widgets/cursor.py.</tt></dd></dl>
<dl><dt><a name="Cursor-clear"><strong>clear</strong></a>(self, event)</dt><dd><tt>clear the cursor</tt></dd></dl>
<dl><dt><a name="Cursor-onmove"><strong>onmove</strong></a>(self, event)</dt><dd><tt>on mouse motion draw the cursor if visible</tt></dd></dl>
</td></tr></table> <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="HorizontalSpanSelector">class <strong>HorizontalSpanSelector</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Select a min/max range of the x axes for a matplotlib Axes<br>
<br>
Example usage:<br>
<br>
ax = subplot(111)<br>
ax.plot(x,y)<br>
<br>
def onselect(xmin, xmax):<br>
print xmin, xmax<br>
span = <a href="#HorizontalSpanSelector">HorizontalSpanSelector</a>(ax, onselect)<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="HorizontalSpanSelector-__init__"><strong>__init__</strong></a>(self, ax, onselect, minspan<font color="#909090">=None</font>, useblit<font color="#909090">=False</font>, rectprops<font color="#909090">=None</font>)</dt><dd><tt>Create a span selector in ax. When a selection is made, clear<br>
the span and call onselect with<br>
<br>
onselect(xmin, xmax)<br>
<br>
and clear the span.<br>
<br>
If minspan is not None, ignore events smaller than minspan<br>
<br>
The span rect is drawn with rectprops; default<br>
rectprops = dict(facecolor='red', alpha=0.5)<br>
<br>
set the visible attribute to False if you want to turn off<br>
the functionality of the span selector</tt></dd></dl>
<dl><dt><a name="HorizontalSpanSelector-ignore"><strong>ignore</strong></a>(self, event)</dt><dd><tt>return True if event should be ignored</tt></dd></dl>
<dl><dt><a name="HorizontalSpanSelector-onmove"><strong>onmove</strong></a>(self, event)</dt><dd><tt>on motion notify event</tt></dd></dl>
<dl><dt><a name="HorizontalSpanSelector-press"><strong>press</strong></a>(self, event)</dt><dd><tt>on button press event</tt></dd></dl>
<dl><dt><a name="HorizontalSpanSelector-release"><strong>release</strong></a>(self, event)</dt><dd><tt>on button release event</tt></dd></dl>
<dl><dt><a name="HorizontalSpanSelector-update"><strong>update</strong></a>(self)</dt><dd><tt>draw using newfangled blit or oldfangled draw depending on useblit</tt></dd></dl>
<dl><dt><a name="HorizontalSpanSelector-update_background"><strong>update_background</strong></a>(self, event)</dt><dd><tt>force an update of the background</tt></dd></dl>
</td></tr></table> <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="RadioButtons">class <strong>RadioButtons</strong></a>(<a href="matplotlib.widgets.html#Widget">Widget</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A GUI neutral radio button<br>
<br>
The following attributes are exposed<br>
<br>
ax - the Axes instance the buttons are in<br>
activecolor - the color of the button when clicked<br>
labels - a list of text.Text instances<br>
circles - a list of patch.Circle instances<br>
<br>
Connect to the <a href="#RadioButtons">RadioButtons</a> with the on_clicked method<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="RadioButtons-__init__"><strong>__init__</strong></a>(self, ax, labels, active<font color="#909090">=0</font>, activecolor<font color="#909090">='blue'</font>)</dt><dd><tt>Add radio buttons to axes.Axes instance ax<br>
<br>
labels is a len(buttons) list of labels as strings<br>
<br>
active is the index into labels for the button that is active<br>
<br>
activecolor is the color of the button when clicked</tt></dd></dl>
<dl><dt><a name="RadioButtons-disconnect"><strong>disconnect</strong></a>(self, cid)</dt><dd><tt>remove the observer with connection id cid</tt></dd></dl>
<dl><dt><a name="RadioButtons-on_clicked"><strong>on_clicked</strong></a>(self, func)</dt><dd><tt>When the button is clicked, call this func with button label<br>
<br>
A connection id is returned which can be used to disconnect</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.widgets.html#Widget">Widget</a>:<br>
<dl><dt><strong>drawon</strong> = True</dl>
<dl><dt><strong>eventson</strong> = True</dl>
</td></tr></table> <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="Slider">class <strong>Slider</strong></a>(<a href="matplotlib.widgets.html#Widget">Widget</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A slider representing a floating point range<br>
<br>
The following attributes are defined <br>
ax : the slider axes.Axes instance<br>
val : the current slider value<br>
vline : a Line2D instance representing the initial value<br>
poly : A patch.Polygon instance which is the slider<br>
valfmt : the format string for formatting the slider text<br>
label : a text.Text instance, the slider label<br>
closedmin : whether the slider is closed on the minimum <br>
closedmax : whether the slider is closed on the maximum<br>
slidermin : another slider - if not None, this slider must be > slidermin<br>
slidermax : another slider - if not None, this slider must be < slidermax<br>
dragging : allow for mouse dragging on slider<br>
<br>
Call on_changed to connect to the slider event<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Slider-__init__"><strong>__init__</strong></a>(self, ax, label, valmin, valmax, valinit<font color="#909090">=0.5</font>, valfmt<font color="#909090">='%1.2f'</font>, closedmin<font color="#909090">=True</font>, closedmax<font color="#909090">=True</font>, slidermin<font color="#909090">=None</font>, slidermax<font color="#909090">=None</font>, dragging<font color="#909090">=True</font>)</dt><dd><tt>Create a slider from valmin to valmax in axes ax;<br>
<br>
valinit - the slider initial position<br>
<br>
label - the slider label <br>
<br>
valfmt - used to format the slider value<br>
<br>
closedmin and closedmax - indicate whether the slider interval is closed<br>
<br>
slidermin and slidermax - be used to contrain the value of<br>
this slider to the values of other sliders.</tt></dd></dl>
<dl><dt><a name="Slider-disconnect"><strong>disconnect</strong></a>(self, cid)</dt><dd><tt>remove the observer with connection id cid</tt></dd></dl>
<dl><dt><a name="Slider-on_changed"><strong>on_changed</strong></a>(self, func)</dt><dd><tt>When the slider valud is changed, call this func with the new<br>
slider position<br>
<br>
A connection id is returned which can be used to disconnect</tt></dd></dl>
<dl><dt><a name="Slider-reset"><strong>reset</strong></a>(self)</dt><dd><tt>reset the slider to the initial value if needed</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.widgets.html#Widget">Widget</a>:<br>
<dl><dt><strong>drawon</strong> = True</dl>
<dl><dt><strong>eventson</strong> = True</dl>
</td></tr></table> <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="SubplotTool">class <strong>SubplotTool</strong></a>(<a href="matplotlib.widgets.html#Widget">Widget</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A tool to adjust to subplot params of fig<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="SubplotTool-__init__"><strong>__init__</strong></a>(self, targetfig, toolfig)</dt><dd><tt>targetfig is the figure to adjust<br>
<br>
toolfig is the figure to embed the the subplot tool into. If<br>
None, a default pylab figure will be created. If you are<br>
using this from the GUI</tt></dd></dl>
<dl><dt><a name="SubplotTool-funcbottom"><strong>funcbottom</strong></a>(self, val)</dt></dl>
<dl><dt><a name="SubplotTool-funchspace"><strong>funchspace</strong></a>(self, val)</dt></dl>
<dl><dt><a name="SubplotTool-funcleft"><strong>funcleft</strong></a>(self, val)</dt></dl>
<dl><dt><a name="SubplotTool-funcright"><strong>funcright</strong></a>(self, val)</dt></dl>
<dl><dt><a name="SubplotTool-functop"><strong>functop</strong></a>(self, val)</dt></dl>
<dl><dt><a name="SubplotTool-funcwspace"><strong>funcwspace</strong></a>(self, val)</dt></dl>
<hr>
Data and other attributes inherited from <a href="matplotlib.widgets.html#Widget">Widget</a>:<br>
<dl><dt><strong>drawon</strong> = True</dl>
<dl><dt><strong>eventson</strong> = True</dl>
</td></tr></table> <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="Widget">class <strong>Widget</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>OK, I couldn't resist; abstract base class for mpl GUI neutral<br>
widgets<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Data and other attributes defined here:<br>
<dl><dt><strong>drawon</strong> = True</dl>
<dl><dt><strong>eventson</strong> = True</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="-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>
</td></tr></table>
@footer@