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 (v2.2.5). For the latest version see <ahref="https://matplotlib.org/stable/api/widgets_api.html">https://matplotlib.org/stable/api/widgets_api.html</a></div>
<spanid="matplotlib-widgets"></span><h2><aclass="reference internal" href="#module-matplotlib.widgets" title="matplotlib.widgets"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">matplotlib.widgets</span></code></a><aclass="headerlink" href="#module-matplotlib.widgets" title="Permalink to this headline">¶</a></h2>
<divclass="section" id="gui-neutral-widgets">
<h3>GUI neutral widgets<aclass="headerlink" href="#gui-neutral-widgets" title="Permalink to this headline">¶</a></h3>
<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-class docutils literal notranslate"><spanclass="pre">matplotlib.axes.Axes</span></code></a>
instance and pass that as the first arg. 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="class">
<dtid="matplotlib.widgets.AxesWidget">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">AxesWidget</code><spanclass="sig-paren">(</span><em>ax</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>
<codeclass="descname">connect_event</code><spanclass="sig-paren">(</span><em>event</em>, <em>callback</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><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="class">
<dtid="matplotlib.widgets.Button">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">Button</code><spanclass="sig-paren">(</span><em>ax</em>, <em>label</em>, <em>image=None</em>, <em>color='0.85'</em>, <em>hovercolor='0.95'</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-meth docutils literal notranslate"><spanclass="pre">on_clicked()</span></code></a> to connect to the button.</p>
<dd><pclass="first last">The color of the button when the mouse is over it</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="method">
<dtid="matplotlib.widgets.Button.disconnect">
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em>cid</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 observer with connection id <em>cid</em></p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.widgets.Button.on_clicked">
<codeclass="descname">on_clicked</code><spanclass="sig-paren">(</span><em>func</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>When the button is clicked, call this <em>func</em> with event.</p>
<p>A connection id is returned. It can be used to disconnect
the button from its callback.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.widgets.CheckButtons">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">CheckButtons</code><spanclass="sig-paren">(</span><em>ax</em>, <em>labels</em>, <em>actives</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>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>
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em>cid</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><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>returns a tuple of the status (True/False) of all of the check buttons</p>
<codeclass="descname">on_clicked</code><spanclass="sig-paren">(</span><em>func</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>When the button is clicked, call <em>func</em> with button label</p>
<p>A connection id is returned which can be used to disconnect</p>
<codeclass="descname">set_active</code><spanclass="sig-paren">(</span><em>index</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="class">
<dtid="matplotlib.widgets.Cursor">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">Cursor</code><spanclass="sig-paren">(</span><em>ax</em>, <em>horizOn=True</em>, <em>vertOn=True</em>, <em>useblit=False</em>, <em>**lineprops</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>
<p>A horizontal and vertical line that spans the axes and moves with
the pointer. You can turn off the hline or vline respectively with
the following attributes:</p>
<blockquote>
<div><dlclass="docutils">
<dt><em>horizOn</em></dt>
<dd>Controls the visibility of the horizontal line</dd>
<dt><em>vertOn</em></dt>
<dd>Controls the visibility of the horizontal line</dd>
</dl>
</div></blockquote>
<p>and the visibility of the cursor itself with the <em>visible</em> attribute.</p>
<p>For the cursor to remain responsive you must keep a reference to
it.</p>
<p>Add a cursor to <em>ax</em>. If <codeclass="docutils literal notranslate"><spanclass="pre">useblit=True</span></code>, use the backend-dependent
blitting features for faster updates. <em>lineprops</em> is a dictionary of
line properties.</p>
<dlclass="method">
<dtid="matplotlib.widgets.Cursor.clear">
<codeclass="descname">clear</code><spanclass="sig-paren">(</span><em>event</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>clear the cursor</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.widgets.Cursor.onmove">
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em>event</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>on mouse motion draw the cursor if visible</p>
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="s1">' used button : '</span><spanclass="p">,</span><spanclass="n">eclick</span><spanclass="o">.</span><spanclass="n">button</span><spanclass="p">)</span>
<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>extents</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="class">
<dtid="matplotlib.widgets.Lasso">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">Lasso</code><spanclass="sig-paren">(</span><em>ax</em>, <em>xy</em>, <em>callback=None</em>, <em>useblit=True</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-func 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-class 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>
<dd><pclass="first last">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="method">
<dtid="matplotlib.widgets.Lasso.onmove">
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em>event</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="method">
<dtid="matplotlib.widgets.Lasso.onrelease">
<codeclass="descname">onrelease</code><spanclass="sig-paren">(</span><em>event</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="class">
<dtid="matplotlib.widgets.LassoSelector">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">LassoSelector</code><spanclass="sig-paren">(</span><em>ax</em>, <em>onselect=None</em>, <em>useblit=True</em>, <em>lineprops=None</em>, <em>button=None</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
<dd><pclass="first">A list of integers indicating which mouse buttons should be used for
rectangle selection. You can also specify a single integer if only a
single button is desired. Default is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, which does not limit
which button can be used.</p>
<p>Note, typically:</p>
<ulclass="last simple">
<li>1 = left mouse button</li>
<li>2 = center mouse button (scroll wheel)</li>
<li>3 = right mouse button</li>
</ul>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="method">
<dtid="matplotlib.widgets.LassoSelector.onpress">
<codeclass="descname">onpress</code><spanclass="sig-paren">(</span><em>event</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>event</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="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. The module level "lock"
allows someone to grab the lock and prevent other widgets from
drawing. Use <codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.widgets.lock(someobj)</span></code> to prevent
other widgets from drawing while you're interacting with the canvas.</p>
<dlclass="method">
<dtid="matplotlib.widgets.LockDraw.available">
<codeclass="descname">available</code><spanclass="sig-paren">(</span><em>o</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>drawing is available to <em>o</em></p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.widgets.LockDraw.isowner">
<codeclass="descname">isowner</code><spanclass="sig-paren">(</span><em>o</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 True if <em>o</em> owns this lock</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.widgets.LockDraw.locked">
<codeclass="descname">locked</code><spanclass="sig-paren">(</span><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 True if the lock is currently held by an owner</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.widgets.LockDraw.release">
<codeclass="descname">release</code><spanclass="sig-paren">(</span><em>o</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</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.widgets.MultiCursor">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">MultiCursor</code><spanclass="sig-paren">(</span><em>canvas</em>, <em>axes</em>, <em>useblit=True</em>, <em>horizOn=False</em>, <em>vertOn=True</em>, <em>**lineprops</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>event</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="method">
<dtid="matplotlib.widgets.MultiCursor.connect">
<codeclass="descname">connect</code><spanclass="sig-paren">(</span><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><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="method">
<dtid="matplotlib.widgets.MultiCursor.onmove">
<codeclass="descname">onmove</code><spanclass="sig-paren">(</span><em>event</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="class">
<dtid="matplotlib.widgets.PolygonSelector">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">PolygonSelector</code><spanclass="sig-paren">(</span><em>ax</em>, <em>onselect</em>, <em>useblit=False</em>, <em>lineprops=None</em>, <em>markerprops=None</em>, <em>vertex_select_radius=15</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>
<dd><pclass="first last">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
<dd><pclass="first last">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>
<dd><pclass="first last">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>
<dd><pclass="first last">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>event</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="attribute">
<dtid="matplotlib.widgets.PolygonSelector.verts">
<codeclass="descname">verts</code><aclass="headerlink" href="#matplotlib.widgets.PolygonSelector.verts" title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>list</strong></dt>
<dd><pclass="first last">A list of the vertices of the polygon as <codeclass="docutils literal notranslate"><spanclass="pre">(xdata,</span><spanclass="pre">ydata)</span></code> tuples.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.widgets.RadioButtons">
<emclass="property">class </em><codeclass="descclassname">matplotlib.widgets.</code><codeclass="descname">RadioButtons</code><spanclass="sig-paren">(</span><em>ax</em>, <em>labels</em>, <em>active=0</em>, <em>activecolor='blue'</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>
<dd>The <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">matplotlib.axes.Axes</span></code></a> instance the buttons are in</dd>
<dt><em>activecolor</em></dt>
<dd>The color of the button when clicked</dd>
<dt><em>labels</em></dt>
<dd>A list of <aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">matplotlib.text.Text</span></code></a> instances</dd>
<dt><em>circles</em></dt>
<dd>A list of <aclass="reference internal" href="_as_gen/matplotlib.patches.Circle.html#matplotlib.patches.Circle" title="matplotlib.patches.Circle"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">matplotlib.patches.Circle</span></code></a> instances</dd>
<dt><em>value_selected</em></dt>
<dd>A string listing the current value selected</dd>
</dl>
</div></blockquote>
<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>
<p>Add radio buttons to <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">matplotlib.axes.Axes</span></code></a> instance <em>ax</em></p>
<dlclass="docutils">
<dt><em>labels</em></dt>
<dd>A len(buttons) list of labels as strings</dd>
<dt><em>active</em></dt>
<dd>The index into labels for the button that is active</dd>
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em>cid</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>func</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>When the button is clicked, call <em>func</em> with button label</p>
<p>A connection id is returned which can be used to disconnect</p>
<codeclass="descname">set_active</code><spanclass="sig-paren">(</span><em>index</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>Trigger which radio button to make active.</p>
<dlclass="docutils">
<dt><em>index</em> is an index into the original label list</dt>
<dd>that this object was constructed with.
Raise ValueError if the index 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>
<spanclass="nb">print</span><spanclass="p">(</span><spanclass="s1">' used button : '</span><spanclass="p">,</span><spanclass="n">eclick</span><spanclass="o">.</span><spanclass="n">button</span><spanclass="p">)</span>
<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">center</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.center" title="Permalink to this definition">¶</a></dt>
<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>extents</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>
<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>
<codeclass="descname">extents</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.extents" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">geometry</code><aclass="headerlink" href="#matplotlib.widgets.RectangleSelector.geometry" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns numpy.ndarray of shape (2,5) containing
x (<codeclass="docutils literal notranslate"><spanclass="pre">RectangleSelector.geometry[1,:]</span></code>) and
y (<codeclass="docutils literal notranslate"><spanclass="pre">RectangleSelector.geometry[0,:]</span></code>)
coordinates of the four corners of the rectangle starting
<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>
<dd><pclass="first last">If given, the slider will snap to multiples of <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">valstep</span></code>.</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-class docutils literal notranslate"><spanclass="pre">Rectangle</span></code></a> that draws the slider
knob. See the <aclass="reference internal" href="_as_gen/matplotlib.patches.Rectangle.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Rectangle</span></code></a> documentation for
<codeclass="descname">disconnect</code><spanclass="sig-paren">(</span><em>cid</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>