You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
<divid="unreleased-message"> You are reading an old version of the documentation (v3.2.2). For the latest version see <ahref="https://matplotlib.org/stable/api/widgets_api.html">https://matplotlib.org/stable/api/widgets_api.html</a></div>
<h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.widgets</span></code><aclass="headerlink" href="#matplotlib-widgets" title="Permalink to this headline">¶</a></h1>
<h2>GUI neutral widgets<aclass="headerlink" href="#gui-neutral-widgets" title="Permalink to this headline">¶</a></h2>
<p>Widgets that are designed to work for any of the GUI backends.
All of these widgets require you to predefine a <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.axes.Axes</span></code></a>
instance and pass that as the first parameter. Matplotlib doesn't try to
be too smart with respect to layout -- you will have to figure out how
wide and tall you want your Axes to be to accommodate your widget.</p>
<dlclass="py class">
<dtid="matplotlib.widgets.AxesWidget">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">AxesWidget</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#AxesWidget"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.AxesWidget" title="Permalink to this definition">¶</a></dt>
<p>Widget that is connected to a single <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a>.</p>
<p>To guarantee that the widget remains responsive and not garbage-collected,
a reference to the object should be maintained by the user.</p>
<p>This is necessary because the callback registry
maintains only weak-refs to the functions, which are member
functions of the widget. If there are no references to the widget
object it may be garbage collected which will disconnect the callbacks.</p>
<codeclass="descname">connect_event</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em>, <em><spanclass="n">callback</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#AxesWidget.connect_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.AxesWidget.connect_event" title="Permalink to this definition">¶</a></dt>
<dd><p>Connect callback with an event.</p>
<p>This should be used in lieu of <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">figure.canvas.mpl_connect</span></code> since this
function stores callback ids for later clean up.</p>
<codeclass="descname">disconnect_events</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#AxesWidget.disconnect_events"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.AxesWidget.disconnect_events" title="Permalink to this definition">¶</a></dt>
<dd><p>Disconnect all events created by this widget.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.Button">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">Button</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">label</span></em>, <em><spanclass="n">image</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">color</span><spanclass="o">=</span><spanclass="default_value">'0.85'</span></em>, <em><spanclass="n">hovercolor</span><spanclass="o">=</span><spanclass="default_value">'0.95'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Button"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Button" title="Permalink to this definition">¶</a></dt>
<p>For the button to remain responsive you must keep a reference to it.
Call <aclass="reference internal" href="#matplotlib.widgets.Button.on_clicked" title="matplotlib.widgets.Button.on_clicked"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">on_clicked</span></code></a> to connect to the button.</p>
<dt><strong>image</strong><spanclass="classifier">array-like or PIL image</span></dt><dd><p>The image to place in the button, if not <em>None</em>.
Supported inputs are the same as for <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" title="matplotlib.axes.Axes.imshow"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes.imshow</span></code></a>.</p>
</dd>
<dt><strong>color</strong><spanclass="classifier">color</span></dt><dd><p>The color of the button when not activated.</p>
</dd>
<dt><strong>hovercolor</strong><spanclass="classifier">color</span></dt><dd><p>The color of the button when the mouse is over it.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="py method">
<dtid="matplotlib.widgets.Button.disconnect">
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">cid</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Button.disconnect"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Button.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the callback function with connection id <em>cid</em>.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.Button.on_clicked">
<codeclass="descname">on_clicked</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">func</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Button.on_clicked"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Button.on_clicked" title="Permalink to this definition">¶</a></dt>
<dd><p>Connect the callback function <em>func</em> to button click events.</p>
<p>Returns a connection id, which can be used to disconnect the callback.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.CheckButtons">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">CheckButtons</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">labels</span></em>, <em><spanclass="n">actives</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#CheckButtons"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.CheckButtons" title="Permalink to this definition">¶</a></dt>
<p>For the check buttons to remain responsive you must keep a
reference to this object.</p>
<p>Connect to the CheckButtons with the <aclass="reference internal" href="#matplotlib.widgets.CheckButtons.on_clicked" title="matplotlib.widgets.CheckButtons.on_clicked"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">on_clicked()</span></code></a> method</p>
<trclass="field-odd field"><thclass="field-name">Attributes:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>ax</strong></dt><dd><p>The <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.axes.Axes</span></code></a> the button are located in.</p>
</dd>
<dt><strong>labels</strong></dt><dd><p>A list of <aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.text.Text</span></code></a>s.</p>
</dd>
<dt><strong>lines</strong></dt><dd><p>List of (line1, line2) tuples for the x's in the check boxes.
These lines exist for each box, but have <codeclass="docutils literal notranslate"><spanclass="pre">set_visible(False)</span></code>
when its box is not checked.</p>
</dd>
<dt><strong>rectangles</strong></dt><dd><p>A list of <aclass="reference internal" href="_as_gen/matplotlib.patches.Rectangle.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.patches.Rectangle</span></code></a>s.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>ax</strong><spanclass="classifier"><aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a></span></dt><dd><p>The parent axes for the widget.</p>
</dd>
<dt><strong>labels</strong><spanclass="classifier">list of str</span></dt><dd><p>The labels of the check buttons.</p>
</dd>
<dt><strong>actives</strong><spanclass="classifier">list of bool, optional</span></dt><dd><p>The initial check states of the buttons. The list must have the
same length as <em>labels</em>. If not given, all buttons are unchecked.</p>
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">cid</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#CheckButtons.disconnect"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.CheckButtons.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>remove the observer with connection id <em>cid</em></p>
<codeclass="descname">get_status</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#CheckButtons.get_status"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.CheckButtons.get_status" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a tuple of the status (True/False) of all of the check buttons.</p>
<codeclass="descname">on_clicked</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">func</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#CheckButtons.on_clicked"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.CheckButtons.on_clicked" title="Permalink to this definition">¶</a></dt>
<dd><p>Connect the callback function <em>func</em> to button click events.</p>
<p>Returns a connection id, which can be used to disconnect the callback.</p>
<codeclass="descname">set_active</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">index</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#CheckButtons.set_active"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.CheckButtons.set_active" title="Permalink to this definition">¶</a></dt>
<dd><p>Directly (de)activate a check button by index.</p>
<dlclass="docutils">
<dt><em>index</em> is an index into the original label list</dt><dd>that this object was constructed with.
Raises ValueError if <em>index</em> is invalid.</dd>
</dl>
<p>Callbacks will be triggered if <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">eventson</span></code> is True.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.Cursor">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">Cursor</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">horizOn</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="n">vertOn</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="n">useblit</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <em><spanclass="o">**</span><spanclass="n">lineprops</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Cursor"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Cursor" title="Permalink to this definition">¶</a></dt>
<dt><strong>horizOn</strong><spanclass="classifier">bool, optional, default: True</span></dt><dd><p>Whether to draw the horizontal line.</p>
</dd>
<dt><strong>vertOn</strong><spanclass="classifier">bool, optional, default: True</span></dt><dd><p>Whether to draw the vertical line.</p>
</dd>
<dt><strong>useblit</strong><spanclass="classifier">bool, optional, default: False</span></dt><dd><p>Use blitting for faster drawing if supported by the backend.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Other Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>**lineprops</strong></dt><dd><p><aclass="reference internal" href="_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Line2D</span></code></a> properties that control the appearance of the lines.
See also <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.axhline.html#matplotlib.axes.Axes.axhline" title="matplotlib.axes.Axes.axhline"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">axhline</span></code></a>.</p>
<codeclass="descname">clear</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Cursor.clear"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Cursor.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Internal event handler to clear the cursor.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.Cursor.onmove">
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Cursor.onmove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Cursor.onmove" title="Permalink to this definition">¶</a></dt>
<dd><p>Internal event handler to draw the cursor when the mouse moves.</p>
<p>and clear the drawn box/line. The <codeclass="docutils literal notranslate"><spanclass="pre">pos_1</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">pos_2</span></code> are
arrays of length 2 containing the x- and y-coordinate.</p>
<p>If <em>minspanx</em> is not <em>None</em> then events smaller than <em>minspanx</em>
in x direction are ignored (it's the same for y).</p>
<p>The rectangle is drawn with <em>rectprops</em>; default:</p>
<codeclass="descname">draw_shape</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">extents</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#EllipseSelector.draw_shape"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.EllipseSelector.draw_shape" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.Lasso">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">Lasso</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">xy</span></em>, <em><spanclass="n">callback</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">useblit</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Lasso"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Lasso" title="Permalink to this definition">¶</a></dt>
<p>The selected path can be used in conjunction with
<aclass="reference internal" href="path_api.html#matplotlib.path.Path.contains_point" title="matplotlib.path.Path.contains_point"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">contains_point</span></code></a> to select data points from an image.</p>
<p>Unlike <aclass="reference internal" href="#matplotlib.widgets.LassoSelector" title="matplotlib.widgets.LassoSelector"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">LassoSelector</span></code></a>, this must be initialized with a starting
point <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">xy</span></code>, and the <aclass="reference internal" href="#matplotlib.widgets.Lasso" title="matplotlib.widgets.Lasso"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Lasso</span></code></a> events are destroyed upon release.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>ax</strong><spanclass="classifier"><aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a></span></dt><dd><p>The parent axes for the widget.</p>
</dd>
<dt><strong>xy</strong><spanclass="classifier">(float, float)</span></dt><dd><p>Coordinates of the start of the lasso.</p>
</dd>
<dt><strong>callback</strong><spanclass="classifier">callable</span></dt><dd><p>Whenever the lasso is released, the <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">callback</span></code> function is called and
passed the vertices of the selected path.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="py method">
<dtid="matplotlib.widgets.Lasso.onmove">
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Lasso.onmove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Lasso.onmove" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.Lasso.onrelease">
<codeclass="descname">onrelease</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Lasso.onrelease"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Lasso.onrelease" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.LassoSelector">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">LassoSelector</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">onselect</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">useblit</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="n">lineprops</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">button</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LassoSelector"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LassoSelector" title="Permalink to this definition">¶</a></dt>
<p>For the selector to remain responsive you must keep a reference to it.</p>
<p>The selected path can be used in conjunction with <aclass="reference internal" href="path_api.html#matplotlib.path.Path.contains_point" title="matplotlib.path.Path.contains_point"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">contains_point</span></code></a>
to select data points from an image.</p>
<p>In contrast to <aclass="reference internal" href="#matplotlib.widgets.Lasso" title="matplotlib.widgets.Lasso"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Lasso</span></code></a>, <aclass="reference internal" href="#matplotlib.widgets.LassoSelector" title="matplotlib.widgets.LassoSelector"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">LassoSelector</span></code></a> is written with an interface
similar to <aclass="reference internal" href="#matplotlib.widgets.RectangleSelector" title="matplotlib.widgets.RectangleSelector"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">RectangleSelector</span></code></a> and <aclass="reference internal" href="#matplotlib.widgets.SpanSelector" title="matplotlib.widgets.SpanSelector"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">SpanSelector</span></code></a>, and will continue to
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>ax</strong><spanclass="classifier"><aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a></span></dt><dd><p>The parent axes for the widget.</p>
</dd>
<dt><strong>onselect</strong><spanclass="classifier">function</span></dt><dd><p>Whenever the lasso is released, the <em>onselect</em> function is called and
passed the vertices of the selected path.</p>
</dd>
<dt><strong>button</strong><spanclass="classifier"><aclass="reference internal" href="backend_bases_api.html#matplotlib.backend_bases.MouseButton" title="matplotlib.backend_bases.MouseButton"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">MouseButton</span></code></a> or list of <aclass="reference internal" href="backend_bases_api.html#matplotlib.backend_bases.MouseButton" title="matplotlib.backend_bases.MouseButton"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">MouseButton</span></code></a>, optional</span></dt><dd><p>The mouse buttons used for rectangle selection. Default is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>,
which corresponds to all buttons.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="py method">
<dtid="matplotlib.widgets.LassoSelector.onpress">
<codeclass="descname">onpress</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LassoSelector.onpress"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LassoSelector.onpress" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">onrelease</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LassoSelector.onrelease"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LassoSelector.onrelease" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.LockDraw">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">LockDraw</code><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LockDraw"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LockDraw" title="Permalink to this definition">¶</a></dt>
<p>Some widgets, like the cursor, draw onto the canvas, and this is not
desirable under all circumstances, like when the toolbar is in zoom-to-rect
mode and drawing a rectangle. To avoid this, a widget can acquire a
canvas' lock with <codeclass="docutils literal notranslate"><spanclass="pre">canvas.widgetlock(widget)</span></code> before drawing on the
canvas; this will prevent other widgets from doing so at the same time (if
they also try to acquire the lock first).</p>
<dlclass="py method">
<dtid="matplotlib.widgets.LockDraw.available">
<codeclass="descname">available</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">o</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LockDraw.available"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LockDraw.available" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether drawing is available to <em>o</em>.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.LockDraw.isowner">
<codeclass="descname">isowner</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">o</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LockDraw.isowner"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LockDraw.isowner" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether <em>o</em> owns this lock.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.LockDraw.locked">
<codeclass="descname">locked</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LockDraw.locked"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LockDraw.locked" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether the lock is currently held by an owner.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.LockDraw.release">
<codeclass="descname">release</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">o</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#LockDraw.release"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.LockDraw.release" title="Permalink to this definition">¶</a></dt>
<dd><p>Release the lock from <em>o</em>.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.MultiCursor">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">MultiCursor</code><spanclass="sig-paren">(</span><em><spanclass="n">canvas</span></em>, <em><spanclass="n">axes</span></em>, <em><spanclass="n">useblit</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="n">horizOn</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <em><spanclass="n">vertOn</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="o">**</span><spanclass="n">lineprops</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#MultiCursor"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.MultiCursor" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">clear</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#MultiCursor.clear"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.MultiCursor.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>clear the cursor</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.MultiCursor.connect">
<codeclass="descname">connect</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#MultiCursor.connect"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.MultiCursor.connect" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#MultiCursor.disconnect"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.MultiCursor.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>disconnect events</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.MultiCursor.onmove">
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#MultiCursor.onmove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.MultiCursor.onmove" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.PolygonSelector">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">PolygonSelector</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">onselect</span></em>, <em><spanclass="n">useblit</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <em><spanclass="n">lineprops</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">markerprops</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">vertex_select_radius</span><spanclass="o">=</span><spanclass="default_value">15</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#PolygonSelector"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.PolygonSelector" title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>ax</strong><spanclass="classifier"><aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a></span></dt><dd><p>The parent axes for the widget.</p>
</dd>
<dt><strong>onselect</strong><spanclass="classifier">function</span></dt><dd><p>When a polygon is completed or modified after completion,
the <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">onselect</span></code> function is called and passed a list of the vertices as
<dt><strong>lineprops</strong><spanclass="classifier">dict, optional</span></dt><dd><p>The line for the sides of the polygon is drawn with the properties
given by <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">lineprops</span></code>. The default is <codeclass="docutils literal notranslate"><spanclass="pre">dict(color='k',</span><spanclass="pre">linestyle='-',</span>
<dt><strong>markerprops</strong><spanclass="classifier">dict, optional</span></dt><dd><p>The markers for the vertices of the polygon are drawn with the
properties given by <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">markerprops</span></code>. The default is <codeclass="docutils literal notranslate"><spanclass="pre">dict(marker='o',</span>
<dt><strong>vertex_select_radius</strong><spanclass="classifier">float, optional</span></dt><dd><p>A vertex is selected (to complete the polygon or to move a vertex)
if the mouse click is within <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">vertex_select_radius</span></code> pixels of the
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#PolygonSelector.onmove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.PolygonSelector.onmove" title="Permalink to this definition">¶</a></dt>
<dd><p>Cursor move event handler and validator</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.PolygonSelector.verts">
<emclass="property">property </em><codeclass="descname">verts</code><aclass="headerlink" href="#matplotlib.widgets.PolygonSelector.verts" title="Permalink to this definition">¶</a></dt>
<dd><p>The polygon vertices, as a list of <codeclass="docutils literal notranslate"><spanclass="pre">(x,</span><spanclass="pre">y)</span></code> pairs.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.widgets.RadioButtons">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">RadioButtons</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">labels</span></em>, <em><spanclass="n">active</span><spanclass="o">=</span><spanclass="default_value">0</span></em>, <em><spanclass="n">activecolor</span><spanclass="o">=</span><spanclass="default_value">'blue'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#RadioButtons"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.RadioButtons" title="Permalink to this definition">¶</a></dt>
<p>For the buttons to remain responsive you must keep a reference to this
object.</p>
<p>Connect to the RadioButtons with the <aclass="reference internal" href="#matplotlib.widgets.RadioButtons.on_clicked" title="matplotlib.widgets.RadioButtons.on_clicked"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">on_clicked()</span></code></a> method.</p>
<dt><strong>activecolor</strong></dt><dd><p>The color of the selected button.</p>
</dd>
<dt><strong>labels</strong></dt><dd><p>A list of <aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Text</span></code></a> instances containing the button labels.</p>
</dd>
<dt><strong>circles</strong></dt><dd><p>A list of <aclass="reference internal" href="_as_gen/matplotlib.patches.Circle.html#matplotlib.patches.Circle" title="matplotlib.patches.Circle"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Circle</span></code></a> instances defining the buttons.</p>
</dd>
<dt><strong>value_selected</strong><spanclass="classifier">str</span></dt><dd><p>The label text of the currently selected button.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<p>Add radio buttons to an <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a>.</p>
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">cid</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#RadioButtons.disconnect"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.RadioButtons.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the observer with connection id <em>cid</em>.</p>
<codeclass="descname">on_clicked</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">func</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#RadioButtons.on_clicked"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.RadioButtons.on_clicked" title="Permalink to this definition">¶</a></dt>
<dd><p>Connect the callback function <em>func</em> to button click events.</p>
<p>Returns a connection id, which can be used to disconnect the callback.</p>
<codeclass="descname">set_active</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">index</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#RadioButtons.set_active"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.RadioButtons.set_active" title="Permalink to this definition">¶</a></dt>
<dd><p>Select button with number <em>index</em>.</p>
<p>Callbacks will be triggered if <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">eventson</span></code> is True.</p>
<p>and clear the drawn box/line. The <codeclass="docutils literal notranslate"><spanclass="pre">pos_1</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">pos_2</span></code> are
arrays of length 2 containing the x- and y-coordinate.</p>
<p>If <em>minspanx</em> is not <em>None</em> then events smaller than <em>minspanx</em>
in x direction are ignored (it's the same for y).</p>
<p>The rectangle is drawn with <em>rectprops</em>; default:</p>
<emclass="property">property </em><codeclass="descname">center</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.center" title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="descname">corners</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.corners" title="Permalink to this definition">¶</a></dt>
<dd><p>Corners of rectangle from lower left, moving clockwise.</p>
<codeclass="descname">draw_shape</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">extents</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#RectangleSelector.draw_shape"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.draw_shape" title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="descname">edge_centers</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.edge_centers" title="Permalink to this definition">¶</a></dt>
<dd><p>Midpoint of rectangle edges from left, moving clockwise.</p>
<emclass="property">property </em><codeclass="descname">extents</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.extents" title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="descname">geometry</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.geometry" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an array of shape (2, 5) containing the
x (<codeclass="docutils literal notranslate"><spanclass="pre">RectangleSelector.geometry[1,</span><spanclass="pre">:]</span></code>) and
y (<codeclass="docutils literal notranslate"><spanclass="pre">RectangleSelector.geometry[0,</span><spanclass="pre">:]</span></code>) coordinates
of the four corners of the rectangle starting and ending
<p>A slider representing a floating point range.</p>
<p>Create a slider from <em>valmin</em> to <em>valmax</em> in axes <em>ax</em>. For the slider to
remain responsive you must maintain a reference to it. Call
<aclass="reference internal" href="#matplotlib.widgets.Slider.on_changed" title="matplotlib.widgets.Slider.on_changed"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">on_changed()</span></code></a> to connect to the slider event.</p>
<dt><strong>valfmt</strong><spanclass="classifier">str, optional, default: "%1.2f"</span></dt><dd><p>Used to format the slider value, fprint format string.</p>
</dd>
<dt><strong>closedmin</strong><spanclass="classifier">bool, optional, default: True</span></dt><dd><p>Whether the slider interval is closed on the bottom.</p>
</dd>
<dt><strong>closedmax</strong><spanclass="classifier">bool, optional, default: True</span></dt><dd><p>Whether the slider interval is closed on the top.</p>
</dd>
<dt><strong>slidermin</strong><spanclass="classifier">Slider, optional, default: None</span></dt><dd><p>Do not allow the current slider to have a value less than
the value of the Slider <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">slidermin</span></code>.</p>
</dd>
<dt><strong>slidermax</strong><spanclass="classifier">Slider, optional, default: None</span></dt><dd><p>Do not allow the current slider to have a value greater than
the value of the Slider <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">slidermax</span></code>.</p>
</dd>
<dt><strong>dragging</strong><spanclass="classifier">bool, optional, default: True</span></dt><dd><p>If True the slider can be dragged by the mouse.</p>
</dd>
<dt><strong>valstep</strong><spanclass="classifier">float, optional, default: None</span></dt><dd><p>If given, the slider will snap to multiples of <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">valstep</span></code>.</p>
</dd>
<dt><strong>orientation</strong><spanclass="classifier">{'horizontal', 'vertical'}, default: 'horizontal'</span></dt><dd><p>The orientation of the slider.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Notes</p>
<p>Additional kwargs are passed on to <codeclass="docutils literal notranslate"><spanclass="pre">self.poly</span></code> which is the
<aclass="reference internal" href="_as_gen/matplotlib.patches.Rectangle.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Rectangle</span></code></a> that draws the slider knob. See the
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">cid</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Slider.disconnect"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Slider.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the observer with connection id <em>cid</em></p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>cid</strong><spanclass="classifier">int</span></dt><dd><p>Connection id of the observer to be removed</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.Slider.on_changed">
<codeclass="descname">on_changed</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">func</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Slider.on_changed"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Slider.on_changed" title="Permalink to this definition">¶</a></dt>
<dd><p>When the slider value is changed call <em>func</em> with the new
<dt><strong>func</strong><spanclass="classifier">callable</span></dt><dd><p>Function to call when slider is changed.
The function must accept a single float as its arguments.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>cid</strong><spanclass="classifier">int</span></dt><dd><p>Connection id (which can be used to disconnect <em>func</em>)</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.widgets.Slider.reset">
<codeclass="descname">reset</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/widgets.html#Slider.reset"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.widgets.Slider.reset" title="Permalink to this definition">¶</a></dt>