Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > bf21b4394f4d7fa09e3626145d3315e0 > files > 723

python-matplotlib-doc-1.2.0-14.fc18.i686.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>widgets &mdash; Matplotlib 1.2.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/mpl.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.2.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Matplotlib 1.2.0 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="top" title="Matplotlib 1.2.0 documentation" href="../index.html" />
    <link rel="up" title="The Matplotlib API" href="index.html" />
    <link rel="next" title="Glossary" href="../glossary/index.html" />
    <link rel="prev" title="units" href="units_api.html" /> 
  </head>
  <body>
<!-- Piwik -->
<script type="text/javascript">
if ("matplotlib.sourceforge.net" == document.location.hostname ||
    "matplotlib.sf.net" == document.location.hostname) {
  var pkBaseURL = (("https:" == document.location.protocol) ? "https://apps.sourceforge.net/piwik/matplotlib/" : "http://apps.sourceforge.net/piwik/matplotlib/");
  document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script type="text/javascript">
if ("matplotlib.sourceforge.net" == document.location.hostname ||
    "matplotlib.sf.net" == document.location.hostname) {
  piwik_action_name = '';
  piwik_idsite = 1;
  piwik_url = pkBaseURL + "piwik.php";
  piwik_log(piwik_action_name, piwik_idsite, piwik_url);
  document.write(unescape('%3Cobject%3E%3Cnoscript%3E%3Cp%3E%3Cimg src="http://apps.sourceforge.net/piwik/matplotlib/piwik.php?idsite=1" alt="piwik"/%3E%3C/p%3E%3C/noscript%3E%3C/object%3E'));
}
</script>
<!-- End Piwik Tag -->
<link rel="shortcut icon" href="_static/favicon.ico">

<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="../index.html"><img src="../_static/logo2.png" border="0" alt="matplotlib"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../glossary/index.html" title="Glossary"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="units_api.html" title="units"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">home</a>|&nbsp;</li>
        <li><a href="../search.html">search</a>|&nbsp;</li>
        <li><a href="../examples/index.html">examples</a>|&nbsp;</li>
        <li><a href="../gallery.html">gallery</a>|&nbsp;</li>
        <li><a href="../contents.html">docs</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">The Matplotlib API</a> &raquo;</li> 
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">widgets</a><ul>
<li><a class="reference internal" href="#module-matplotlib.widgets"><tt class="docutils literal"><span class="pre">matplotlib.widgets</span></tt></a><ul>
<li><a class="reference internal" href="#gui-neutral-widgets">GUI Neutral widgets</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="units_api.html"
                        title="previous chapter">units</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../glossary/index.html"
                        title="next chapter">Glossary</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/api/widgets_api.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="widgets">
<h1>widgets<a class="headerlink" href="#widgets" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-matplotlib.widgets">
<span id="matplotlib-widgets"></span><h2><a class="reference internal" href="#module-matplotlib.widgets" title="matplotlib.widgets"><tt class="xref py py-mod docutils literal"><span class="pre">matplotlib.widgets</span></tt></a><a class="headerlink" href="#module-matplotlib.widgets" title="Permalink to this headline">¶</a></h2>
<div class="section" id="gui-neutral-widgets">
<h3>GUI Neutral widgets<a class="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 an <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a>
instance and pass that as the first arg.  matplotlib doesn&#8217;t try to
be too smart with respect to layout &#8211; you will have to figure out how
wide and tall you want your Axes to be to accommodate your widget.</p>
<dl class="class">
<dt id="matplotlib.widgets.AxesWidget">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">AxesWidget</tt><big>(</big><em>ax</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.AxesWidget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.Widget" title="matplotlib.widgets.Widget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.Widget</span></tt></a></p>
<p>Widget that is connected to a single <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">Axes</span></tt></a>.</p>
<p>Attributes:</p>
<dl class="docutils">
<dt><em>ax</em> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">Axes</span></tt></a></span></dt>
<dd>The parent axes for the widget</dd>
<dt><em>canvas</em> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference internal" href="backend_bases_api.html#matplotlib.backend_bases.FigureCanvasBase" title="matplotlib.backend_bases.FigureCanvasBase"><tt class="xref py py-class docutils literal"><span class="pre">FigureCanvasBase</span></tt></a> subclass</span></dt>
<dd>The parent figure canvas for the widget.</dd>
<dt><em>active</em> <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
<dd>If False, the widget does not respond to events.</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.AxesWidget.connect_event">
<tt class="descname">connect_event</tt><big>(</big><em>event</em>, <em>callback</em><big>)</big><a class="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 <tt class="xref py py-obj docutils literal"><span class="pre">figure.canvas.mpl_connect</span></tt> since this
function stores call back ids for later clean up.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.AxesWidget.disconnect_events">
<tt class="descname">disconnect_events</tt><big>(</big><big>)</big><a class="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>

<dl class="method">
<dt id="matplotlib.widgets.AxesWidget.ignore">
<tt class="descname">ignore</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.AxesWidget.ignore" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if event should be ignored.</p>
<p>This method (or a version of it) should be called at the beginning
of any event callback.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.Button">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">Button</tt><big>(</big><em>ax</em>, <em>label</em>, <em>image=None</em>, <em>color='0.85'</em>, <em>hovercolor='0.95'</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Button" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>A GUI neutral button</p>
<p>The following attributes are accessible</p>
<blockquote>
<div><dl class="docutils">
<dt><em>ax</em></dt>
<dd>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a> the button renders into.</dd>
<dt><em>label</em></dt>
<dd>A <a class="reference internal" href="artist_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.text.Text</span></tt></a> instance.</dd>
<dt><em>color</em></dt>
<dd>The color of the button when not hovering.</dd>
<dt><em>hovercolor</em></dt>
<dd>The color of the button when hovering.</dd>
</dl>
</div></blockquote>
<p>Call <a class="reference internal" href="#matplotlib.widgets.Button.on_clicked" title="matplotlib.widgets.Button.on_clicked"><tt class="xref py py-meth docutils literal"><span class="pre">on_clicked()</span></tt></a> to connect to the button</p>
<dl class="docutils">
<dt><em>ax</em></dt>
<dd>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a> instance the button
will be placed into.</dd>
<dt><em>label</em></dt>
<dd>The button text. Accepts string.</dd>
<dt><em>image</em></dt>
<dd>The image to place in the button, if not <em>None</em>.
Can be any legal arg to imshow (numpy array,
matplotlib Image instance, or PIL image).</dd>
<dt><em>color</em></dt>
<dd>The color of the button when not activated</dd>
<dt><em>hovercolor</em></dt>
<dd>The color of the button when the mouse is over it</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.Button.disconnect">
<tt class="descname">disconnect</tt><big>(</big><em>cid</em><big>)</big><a class="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>

<dl class="method">
<dt id="matplotlib.widgets.Button.on_clicked">
<tt class="descname">on_clicked</tt><big>(</big><em>func</em><big>)</big><a class="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 which can be used to disconnect</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.CheckButtons">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">CheckButtons</tt><big>(</big><em>ax</em>, <em>labels</em>, <em>actives</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.CheckButtons" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>A GUI neutral radio button</p>
<p>The following attributes are exposed</p>
<blockquote>
<div><dl class="docutils">
<dt><em>ax</em></dt>
<dd>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a> instance the buttons are
located in</dd>
<dt><em>labels</em></dt>
<dd>List of <a class="reference internal" href="artist_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.text.Text</span></tt></a> instances</dd>
<dt><em>lines</em></dt>
<dd>List of (line1, line2) tuples for the x&#8217;s in the check boxes.
These lines exist for each box, but have <tt class="docutils literal"><span class="pre">set_visible(False)</span></tt>
when its box is not checked.</dd>
<dt><em>rectangles</em></dt>
<dd>List of <a class="reference internal" href="artist_api.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.patches.Rectangle</span></tt></a> instances</dd>
</dl>
</div></blockquote>
<p>Connect to the CheckButtons with the <a class="reference internal" href="#matplotlib.widgets.CheckButtons.on_clicked" title="matplotlib.widgets.CheckButtons.on_clicked"><tt class="xref py py-meth docutils literal"><span class="pre">on_clicked()</span></tt></a> method</p>
<p>Add check buttons to <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a> instance <em>ax</em></p>
<dl class="docutils">
<dt><em>labels</em></dt>
<dd>A len(buttons) list of labels as strings</dd>
<dt><em>actives</em></dt>
<dd><dl class="first last docutils">
<dt>A len(buttons) list of booleans indicating whether</dt>
<dd>the button is active</dd>
</dl>
</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.CheckButtons.disconnect">
<tt class="descname">disconnect</tt><big>(</big><em>cid</em><big>)</big><a class="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>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.CheckButtons.on_clicked">
<tt class="descname">on_clicked</tt><big>(</big><em>func</em><big>)</big><a class="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>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.Cursor">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">Cursor</tt><big>(</big><em>ax</em>, <em>useblit=False</em>, <em>**lineprops</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Cursor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>A horizontal and vertical line span the axes that and move with
the pointer.  You can turn off the hline or vline spectively with
the attributes</p>
<blockquote>
<div><dl class="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>Add a cursor to <em>ax</em>.  If <tt class="docutils literal"><span class="pre">useblit=True</span></tt>, use the backend-
dependent blitting features for faster updates (GTKAgg
only for now).  <em>lineprops</em> is a dictionary of line properties.</p>
<p>(<a class="reference external" href="../mpl_examples/widgets/cursor.py">Source code</a>)</p>
<dl class="method">
<dt id="matplotlib.widgets.Cursor.clear">
<tt class="descname">clear</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Cursor.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>clear the cursor</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.Cursor.onmove">
<tt class="descname">onmove</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Cursor.onmove" title="Permalink to this definition">¶</a></dt>
<dd><p>on mouse motion draw the cursor if visible</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.HorizontalSpanSelector">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">HorizontalSpanSelector</tt><big>(</big><em>ax</em>, <em>onselect</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.HorizontalSpanSelector" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.SpanSelector" title="matplotlib.widgets.SpanSelector"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.SpanSelector</span></tt></a></p>
</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.Lasso">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">Lasso</tt><big>(</big><em>ax</em>, <em>xy</em>, <em>callback=None</em>, <em>useblit=True</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Lasso" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>Selection curve of an arbitrary shape.</p>
<p>The selected path can be used in conjunction with
<a class="reference internal" href="path_api.html#matplotlib.path.Path.contains_point" title="matplotlib.path.Path.contains_point"><tt class="xref py py-func docutils literal"><span class="pre">contains_point()</span></tt></a> to select data points
from an image.</p>
<p>Unlike <a class="reference internal" href="#matplotlib.widgets.LassoSelector" title="matplotlib.widgets.LassoSelector"><tt class="xref py py-class docutils literal"><span class="pre">LassoSelector</span></tt></a>, this must be initialized with a starting
point <tt class="xref py py-obj docutils literal"><span class="pre">xy</span></tt>, and the <a class="reference internal" href="#matplotlib.widgets.Lasso" title="matplotlib.widgets.Lasso"><tt class="xref py py-obj docutils literal"><span class="pre">Lasso</span></tt></a> events are destroyed upon release.</p>
<p>Parameters:</p>
<dl class="docutils">
<dt><em>ax</em> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">Axes</span></tt></a></span></dt>
<dd>The parent axes for the widget.</dd>
<dt><em>xy</em> <span class="classifier-delimiter">:</span> <span class="classifier">array</span></dt>
<dd>Coordinates of the start of the lasso.</dd>
<dt><em>callback</em> <span class="classifier-delimiter">:</span> <span class="classifier">function</span></dt>
<dd>Whenever the lasso is released, the <tt class="xref py py-obj docutils literal"><span class="pre">callback</span></tt> function is called and
passed the vertices of the selected path.</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.Lasso.onmove">
<tt class="descname">onmove</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Lasso.onmove" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.Lasso.onrelease">
<tt class="descname">onrelease</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Lasso.onrelease" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.LassoSelector">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">LassoSelector</tt><big>(</big><em>ax</em>, <em>onselect=None</em>, <em>useblit=True</em>, <em>lineprops=None</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LassoSelector" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>Selection curve of an arbitrary shape.</p>
<p>The selected path can be used in conjunction with
<a href="#id1"><span class="problematic" id="id2">:function:`~matplotlib.path.Path.contains_point`</span></a> to select
data points from an image.</p>
<p>In contrast to <a class="reference internal" href="#matplotlib.widgets.Lasso" title="matplotlib.widgets.Lasso"><tt class="xref py py-class docutils literal"><span class="pre">Lasso</span></tt></a>, <a class="reference internal" href="#matplotlib.widgets.LassoSelector" title="matplotlib.widgets.LassoSelector"><tt class="xref py py-obj docutils literal"><span class="pre">LassoSelector</span></tt></a> is written with an interface
similar to <a class="reference internal" href="#matplotlib.widgets.RectangleSelector" title="matplotlib.widgets.RectangleSelector"><tt class="xref py py-class docutils literal"><span class="pre">RectangleSelector</span></tt></a> and <a class="reference internal" href="#matplotlib.widgets.SpanSelector" title="matplotlib.widgets.SpanSelector"><tt class="xref py py-class docutils literal"><span class="pre">SpanSelector</span></tt></a> and will
continue to interact with the axes until disconnected.</p>
<p>Parameters:</p>
<dl class="docutils">
<dt><em>ax</em> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">Axes</span></tt></a></span></dt>
<dd>The parent axes for the widget.</dd>
<dt><em>onselect</em> <span class="classifier-delimiter">:</span> <span class="classifier">function</span></dt>
<dd>Whenever the lasso is released, the <tt class="xref py py-obj docutils literal"><span class="pre">onselect</span></tt> function is called and
passed the vertices of the selected path.</dd>
</dl>
<p>Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">ax</span> <span class="o">=</span> <span class="n">subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">onselect</span><span class="p">(</span><span class="n">verts</span><span class="p">):</span>
    <span class="k">print</span> <span class="n">verts</span>
<span class="n">lasso</span> <span class="o">=</span> <span class="n">LassoSelector</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">onselect</span><span class="p">)</span>
</pre></div>
</div>
<dl class="method">
<dt id="matplotlib.widgets.LassoSelector.ignore">
<tt class="descname">ignore</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LassoSelector.ignore" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.LassoSelector.onmove">
<tt class="descname">onmove</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LassoSelector.onmove" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.LassoSelector.onpress">
<tt class="descname">onpress</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LassoSelector.onpress" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.LassoSelector.onrelease">
<tt class="descname">onrelease</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LassoSelector.onrelease" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.LassoSelector.update_background">
<tt class="descname">update_background</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LassoSelector.update_background" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.LockDraw">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">LockDraw</tt><a class="headerlink" href="#matplotlib.widgets.LockDraw" title="Permalink to this definition">¶</a></dt>
<dd><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 &#8220;lock&#8221;
allows someone to grab the lock and prevent other widgets from
drawing.  Use <tt class="docutils literal"><span class="pre">matplotlib.widgets.lock(someobj)</span></tt> to pr</p>
<dl class="method">
<dt id="matplotlib.widgets.LockDraw.available">
<tt class="descname">available</tt><big>(</big><em>o</em><big>)</big><a class="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>

<dl class="method">
<dt id="matplotlib.widgets.LockDraw.isowner">
<tt class="descname">isowner</tt><big>(</big><em>o</em><big>)</big><a class="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>

<dl class="method">
<dt id="matplotlib.widgets.LockDraw.locked">
<tt class="descname">locked</tt><big>(</big><big>)</big><a class="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>

<dl class="method">
<dt id="matplotlib.widgets.LockDraw.release">
<tt class="descname">release</tt><big>(</big><em>o</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.LockDraw.release" title="Permalink to this definition">¶</a></dt>
<dd><p>release the lock</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.MultiCursor">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">MultiCursor</tt><big>(</big><em>canvas</em>, <em>axes</em>, <em>useblit=True</em>, <em>**lineprops</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.MultiCursor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.Widget" title="matplotlib.widgets.Widget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.Widget</span></tt></a></p>
<p>Provide a vertical line cursor shared between multiple axes</p>
<p>Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">matplotlib.widgets</span> <span class="kn">import</span> <span class="n">MultiCursor</span>
<span class="kn">from</span> <span class="nn">pylab</span> <span class="kn">import</span> <span class="n">figure</span><span class="p">,</span> <span class="n">show</span><span class="p">,</span> <span class="n">np</span>

<span class="n">t</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">,</span> <span class="mf">0.01</span><span class="p">)</span>
<span class="n">s1</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="o">*</span><span class="n">t</span><span class="p">)</span>
<span class="n">s2</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="o">*</span><span class="n">t</span><span class="p">)</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">figure</span><span class="p">()</span>
<span class="n">ax1</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">211</span><span class="p">)</span>
<span class="n">ax1</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">s1</span><span class="p">)</span>


<span class="n">ax2</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">212</span><span class="p">,</span> <span class="n">sharex</span><span class="o">=</span><span class="n">ax1</span><span class="p">)</span>
<span class="n">ax2</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">s2</span><span class="p">)</span>

<span class="n">multi</span> <span class="o">=</span> <span class="n">MultiCursor</span><span class="p">(</span><span class="n">fig</span><span class="o">.</span><span class="n">canvas</span><span class="p">,</span> <span class="p">(</span><span class="n">ax1</span><span class="p">,</span> <span class="n">ax2</span><span class="p">),</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;r&#39;</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
<dl class="method">
<dt id="matplotlib.widgets.MultiCursor.clear">
<tt class="descname">clear</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.MultiCursor.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>clear the cursor</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.MultiCursor.onmove">
<tt class="descname">onmove</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.MultiCursor.onmove" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.RadioButtons">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">RadioButtons</tt><big>(</big><em>ax</em>, <em>labels</em>, <em>active=0</em>, <em>activecolor='blue'</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RadioButtons" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>A GUI neutral radio button</p>
<p>The following attributes are exposed</p>
<blockquote>
<div><dl class="docutils">
<dt><em>ax</em></dt>
<dd>The <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></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 <a class="reference internal" href="artist_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.text.Text</span></tt></a> instances</dd>
<dt><em>circles</em></dt>
<dd>A list of <a class="reference internal" href="artist_api.html#matplotlib.patches.Circle" title="matplotlib.patches.Circle"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.patches.Circle</span></tt></a> instances</dd>
</dl>
</div></blockquote>
<p>Connect to the RadioButtons with the <a class="reference internal" href="#matplotlib.widgets.RadioButtons.on_clicked" title="matplotlib.widgets.RadioButtons.on_clicked"><tt class="xref py py-meth docutils literal"><span class="pre">on_clicked()</span></tt></a> method</p>
<p>Add radio buttons to <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a> instance <em>ax</em></p>
<dl class="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>
<dt><em>activecolor</em></dt>
<dd>The color of the button when clicked</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.RadioButtons.disconnect">
<tt class="descname">disconnect</tt><big>(</big><em>cid</em><big>)</big><a class="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>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RadioButtons.on_clicked">
<tt class="descname">on_clicked</tt><big>(</big><em>func</em><big>)</big><a class="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>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.RectangleSelector">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">RectangleSelector</tt><big>(</big><em>ax</em>, <em>onselect</em>, <em>drawtype='box'</em>, <em>minspanx=None</em>, <em>minspany=None</em>, <em>useblit=False</em>, <em>lineprops=None</em>, <em>rectprops=None</em>, <em>spancoords='data'</em>, <em>button=None</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>Select a min/max range of the x axes for a matplotlib Axes</p>
<p>Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">matplotlib.widgets</span> <span class="kn">import</span>  <span class="n">RectangleSelector</span>
<span class="kn">from</span> <span class="nn">pylab</span> <span class="kn">import</span> <span class="o">*</span>

<span class="k">def</span> <span class="nf">onselect</span><span class="p">(</span><span class="n">eclick</span><span class="p">,</span> <span class="n">erelease</span><span class="p">):</span>
  <span class="s">&#39;eclick and erelease are matplotlib events at press and release&#39;</span>
  <span class="k">print</span> <span class="s">&#39; startposition : (</span><span class="si">%f</span><span class="s">, </span><span class="si">%f</span><span class="s">)&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">eclick</span><span class="o">.</span><span class="n">xdata</span><span class="p">,</span> <span class="n">eclick</span><span class="o">.</span><span class="n">ydata</span><span class="p">)</span>
  <span class="k">print</span> <span class="s">&#39; endposition   : (</span><span class="si">%f</span><span class="s">, </span><span class="si">%f</span><span class="s">)&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">erelease</span><span class="o">.</span><span class="n">xdata</span><span class="p">,</span> <span class="n">erelease</span><span class="o">.</span><span class="n">ydata</span><span class="p">)</span>
  <span class="k">print</span> <span class="s">&#39; used button   : &#39;</span><span class="p">,</span> <span class="n">eclick</span><span class="o">.</span><span class="n">button</span>

<span class="k">def</span> <span class="nf">toggle_selector</span><span class="p">(</span><span class="n">event</span><span class="p">):</span>
    <span class="k">print</span> <span class="s">&#39; Key pressed.&#39;</span>
    <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;Q&#39;</span><span class="p">,</span> <span class="s">&#39;q&#39;</span><span class="p">]</span> <span class="ow">and</span> <span class="n">toggle_selector</span><span class="o">.</span><span class="n">RS</span><span class="o">.</span><span class="n">active</span><span class="p">:</span>
        <span class="k">print</span> <span class="s">&#39; RectangleSelector deactivated.&#39;</span>
        <span class="n">toggle_selector</span><span class="o">.</span><span class="n">RS</span><span class="o">.</span><span class="n">set_active</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">,</span> <span class="s">&#39;a&#39;</span><span class="p">]</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">toggle_selector</span><span class="o">.</span><span class="n">RS</span><span class="o">.</span><span class="n">active</span><span class="p">:</span>
        <span class="k">print</span> <span class="s">&#39; RectangleSelector activated.&#39;</span>
        <span class="n">toggle_selector</span><span class="o">.</span><span class="n">RS</span><span class="o">.</span><span class="n">set_active</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>

<span class="n">x</span> <span class="o">=</span> <span class="n">arange</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="mf">99.0</span><span class="p">)</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">figure</span>
<span class="n">ax</span> <span class="o">=</span> <span class="n">subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)</span>

<span class="n">toggle_selector</span><span class="o">.</span><span class="n">RS</span> <span class="o">=</span> <span class="n">RectangleSelector</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">onselect</span><span class="p">,</span> <span class="n">drawtype</span><span class="o">=</span><span class="s">&#39;line&#39;</span><span class="p">)</span>
<span class="n">connect</span><span class="p">(</span><span class="s">&#39;key_press_event&#39;</span><span class="p">,</span> <span class="n">toggle_selector</span><span class="p">)</span>
<span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
<p>Create a selector in <em>ax</em>.  When a selection is made, clear
the span and call onselect with:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">onselect</span><span class="p">(</span><span class="n">pos_1</span><span class="p">,</span> <span class="n">pos_2</span><span class="p">)</span>
</pre></div>
</div>
<p>and clear the drawn box/line. The <tt class="docutils literal"><span class="pre">pos_1</span></tt> and <tt class="docutils literal"><span class="pre">pos_2</span></tt> 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&#8217;s the same for y).</p>
<p>The rectangle is drawn with <em>rectprops</em>; default:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">rectprops</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">facecolor</span><span class="o">=</span><span class="s">&#39;red&#39;</span><span class="p">,</span> <span class="n">edgecolor</span> <span class="o">=</span> <span class="s">&#39;black&#39;</span><span class="p">,</span>
                 <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">fill</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
</pre></div>
</div>
<p>The line is drawn with <em>lineprops</em>; default:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">lineprops</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">color</span><span class="o">=</span><span class="s">&#39;black&#39;</span><span class="p">,</span> <span class="n">linestyle</span><span class="o">=</span><span class="s">&#39;-&#39;</span><span class="p">,</span>
                 <span class="n">linewidth</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
</pre></div>
</div>
<p>Use <em>drawtype</em> if you want the mouse to draw a line,
a box or nothing between click and actual position by setting</p>
<p><tt class="docutils literal"><span class="pre">drawtype</span> <span class="pre">=</span> <span class="pre">'line'</span></tt>, <tt class="docutils literal"><span class="pre">drawtype='box'</span></tt> or <tt class="docutils literal"><span class="pre">drawtype</span> <span class="pre">=</span> <span class="pre">'none'</span></tt>.</p>
<p><em>spancoords</em> is one of &#8216;data&#8217; or &#8216;pixels&#8217;.  If &#8216;data&#8217;, <em>minspanx</em>
and <em>minspanx</em> will be interpreted in the same coordinates as
the x and y axis. If &#8216;pixels&#8217;, they are in pixels.</p>
<p><em>button</em> is 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 <em>None</em>,
which does not limit which button can be used.</p>
<dl class="docutils">
<dt>Note, typically:</dt>
<dd>1 = left mouse button
2 = center mouse button (scroll wheel)
3 = right mouse button</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.get_active">
<tt class="descname">get_active</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.get_active" title="Permalink to this definition">¶</a></dt>
<dd><p>Get status of active mode (boolean variable)</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.ignore">
<tt class="descname">ignore</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.ignore" title="Permalink to this definition">¶</a></dt>
<dd><p>return <em>True</em> if <em>event</em> should be ignored</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.onmove">
<tt class="descname">onmove</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.onmove" title="Permalink to this definition">¶</a></dt>
<dd><p>on motion notify event if box/line is wanted</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.press">
<tt class="descname">press</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.press" title="Permalink to this definition">¶</a></dt>
<dd><p>on button press event</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.release">
<tt class="descname">release</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.release" title="Permalink to this definition">¶</a></dt>
<dd><p>on button release event</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.set_active">
<tt class="descname">set_active</tt><big>(</big><em>active</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.set_active" title="Permalink to this definition">¶</a></dt>
<dd><p>Use this to activate / deactivate the RectangleSelector
from your program with an boolean parameter <em>active</em>.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.update">
<tt class="descname">update</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.update" title="Permalink to this definition">¶</a></dt>
<dd><p>draw using newfangled blit or oldfangled draw depending on useblit</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.RectangleSelector.update_background">
<tt class="descname">update_background</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.RectangleSelector.update_background" title="Permalink to this definition">¶</a></dt>
<dd><p>force an update of the background</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.Slider">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">Slider</tt><big>(</big><em>ax</em>, <em>label</em>, <em>valmin</em>, <em>valmax</em>, <em>valinit=0.5</em>, <em>valfmt='%1.2f'</em>, <em>closedmin=True</em>, <em>closedmax=True</em>, <em>slidermin=None</em>, <em>slidermax=None</em>, <em>dragging=True</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Slider" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>A slider representing a floating point range</p>
<dl class="docutils">
<dt>The following attributes are defined</dt>
<dd><p class="first"><em>ax</em>        : the slider <a class="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.axes.Axes</span></tt></a> instance</p>
<p><em>val</em>       : the current slider value</p>
<dl class="docutils">
<dt><em>vline</em> <span class="classifier-delimiter">:</span> <span class="classifier">a <a class="reference internal" href="artist_api.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.lines.Line2D</span></tt></a> instance</span></dt>
<dd>representing the initial value of the slider</dd>
<dt><em>poly</em> <span class="classifier-delimiter">:</span> <span class="classifier">A <a class="reference internal" href="artist_api.html#matplotlib.patches.Polygon" title="matplotlib.patches.Polygon"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.patches.Polygon</span></tt></a> instance</span></dt>
<dd>which is the slider knob</dd>
</dl>
<p><em>valfmt</em>    : the format string for formatting the slider text</p>
<dl class="docutils">
<dt><em>label</em> <span class="classifier-delimiter">:</span> <span class="classifier">a <a class="reference internal" href="artist_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.text.Text</span></tt></a> instance</span></dt>
<dd>for the slider label</dd>
</dl>
<p><em>closedmin</em> : whether the slider is closed on the minimum</p>
<p><em>closedmax</em> : whether the slider is closed on the maximum</p>
<dl class="docutils">
<dt><em>slidermin</em> <span class="classifier-delimiter">:</span> <span class="classifier">another slider - if not <em>None</em>, this slider must be</span></dt>
<dd>greater than <em>slidermin</em></dd>
<dt><em>slidermax</em> <span class="classifier-delimiter">:</span> <span class="classifier">another slider - if not <em>None</em>, this slider must be</span></dt>
<dd>less than <em>slidermax</em></dd>
</dl>
<p class="last"><em>dragging</em>  : allow for mouse dragging on slider</p>
</dd>
</dl>
<p>Call <a class="reference internal" href="#matplotlib.widgets.Slider.on_changed" title="matplotlib.widgets.Slider.on_changed"><tt class="xref py py-meth docutils literal"><span class="pre">on_changed()</span></tt></a> to connect to the slider event</p>
<p>Create a slider from <em>valmin</em> to <em>valmax</em> in axes <em>ax</em></p>
<dl class="docutils">
<dt><em>valinit</em></dt>
<dd>The slider initial position</dd>
<dt><em>label</em></dt>
<dd>The slider label</dd>
<dt><em>valfmt</em></dt>
<dd>Used to format the slider value</dd>
<dt><em>closedmin</em> and <em>closedmax</em></dt>
<dd>Indicate whether the slider interval is closed</dd>
<dt><em>slidermin</em> and <em>slidermax</em></dt>
<dd>Used to constrain the value of this slider to the values
of other sliders.</dd>
</dl>
<p>additional kwargs are passed on to <tt class="docutils literal"><span class="pre">self.poly</span></tt> which is the
<a class="reference internal" href="artist_api.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.patches.Rectangle</span></tt></a> which draws the slider
knob.  See the <a class="reference internal" href="artist_api.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.patches.Rectangle</span></tt></a> documentation
valid property names (e.g., <em>facecolor</em>, <em>edgecolor</em>, <em>alpha</em>, ...)</p>
<dl class="method">
<dt id="matplotlib.widgets.Slider.disconnect">
<tt class="descname">disconnect</tt><big>(</big><em>cid</em><big>)</big><a class="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>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.Slider.on_changed">
<tt class="descname">on_changed</tt><big>(</big><em>func</em><big>)</big><a class="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
slider position</p>
<p>A connection id is returned which can be used to disconnect</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.Slider.reset">
<tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.widgets.Slider.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>reset the slider to the initial value if needed</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.Slider.set_val">
<tt class="descname">set_val</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.Slider.set_val" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.SpanSelector">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">SpanSelector</tt><big>(</big><em>ax</em>, <em>onselect</em>, <em>direction</em>, <em>minspan=None</em>, <em>useblit=False</em>, <em>rectprops=None</em>, <em>onmove_callback=None</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.AxesWidget" title="matplotlib.widgets.AxesWidget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.AxesWidget</span></tt></a></p>
<p>Select a min/max range of the x or y axes for a matplotlib Axes</p>
<p>Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">ax</span> <span class="o">=</span> <span class="n">subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">onselect</span><span class="p">(</span><span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span><span class="p">):</span>
    <span class="k">print</span> <span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span>
<span class="n">span</span> <span class="o">=</span> <span class="n">SpanSelector</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">onselect</span><span class="p">,</span> <span class="s">&#39;horizontal&#39;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="docutils">
<dt><em>onmove_callback</em> is an optional callback that is called on mouse</dt>
<dd>move within the span range</dd>
</dl>
<p>Create a span selector in <em>ax</em>.  When a selection is made, clear
the span and call <em>onselect</em> with:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">onselect</span><span class="p">(</span><span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span><span class="p">)</span>
</pre></div>
</div>
<p>and clear the span.</p>
<p><em>direction</em> must be &#8216;horizontal&#8217; or &#8216;vertical&#8217;</p>
<p>If <em>minspan</em> is not <em>None</em>, ignore events smaller than <em>minspan</em></p>
<dl class="docutils">
<dt>The span rectangle is drawn with <em>rectprops</em>; default::</dt>
<dd>rectprops = dict(facecolor=&#8217;red&#8217;, alpha=0.5)</dd>
</dl>
<p>Set the visible attribute to <em>False</em> if you want to turn off
the functionality of the span selector</p>
<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.ignore">
<tt class="descname">ignore</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.ignore" title="Permalink to this definition">¶</a></dt>
<dd><p>return <em>True</em> if <em>event</em> should be ignored</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.new_axes">
<tt class="descname">new_axes</tt><big>(</big><em>ax</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.new_axes" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.onmove">
<tt class="descname">onmove</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.onmove" title="Permalink to this definition">¶</a></dt>
<dd><p>on motion notify event</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.press">
<tt class="descname">press</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.press" title="Permalink to this definition">¶</a></dt>
<dd><p>on button press event</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.release">
<tt class="descname">release</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.release" title="Permalink to this definition">¶</a></dt>
<dd><p>on button release event</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.update">
<tt class="descname">update</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw using newfangled blit or oldfangled draw depending
on <em>useblit</em></p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SpanSelector.update_background">
<tt class="descname">update_background</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SpanSelector.update_background" title="Permalink to this definition">¶</a></dt>
<dd><p>force an update of the background</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.SubplotTool">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">SubplotTool</tt><big>(</big><em>targetfig</em>, <em>toolfig</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#matplotlib.widgets.Widget" title="matplotlib.widgets.Widget"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.widgets.Widget</span></tt></a></p>
<p>A tool to adjust to subplot params of a <a class="reference internal" href="figure_api.html#matplotlib.figure.Figure" title="matplotlib.figure.Figure"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.figure.Figure</span></tt></a></p>
<dl class="docutils">
<dt><em>targetfig</em></dt>
<dd>The figure instance to adjust</dd>
<dt><em>toolfig</em></dt>
<dd>The figure instance to embed the subplot tool into. If
None, a default figure will be created. If you are using
this from the GUI</dd>
</dl>
<dl class="method">
<dt id="matplotlib.widgets.SubplotTool.funcbottom">
<tt class="descname">funcbottom</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool.funcbottom" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SubplotTool.funchspace">
<tt class="descname">funchspace</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool.funchspace" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SubplotTool.funcleft">
<tt class="descname">funcleft</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool.funcleft" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SubplotTool.funcright">
<tt class="descname">funcright</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool.funcright" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SubplotTool.functop">
<tt class="descname">functop</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool.functop" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.widgets.SubplotTool.funcwspace">
<tt class="descname">funcwspace</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#matplotlib.widgets.SubplotTool.funcwspace" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.widgets.Widget">
<em class="property">class </em><tt class="descclassname">matplotlib.widgets.</tt><tt class="descname">Widget</tt><a class="headerlink" href="#matplotlib.widgets.Widget" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Abstract base class for GUI neutral widgets</p>
<dl class="attribute">
<dt id="matplotlib.widgets.Widget.drawon">
<tt class="descname">drawon</tt><em class="property"> = True</em><a class="headerlink" href="#matplotlib.widgets.Widget.drawon" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="matplotlib.widgets.Widget.eventson">
<tt class="descname">eventson</tt><em class="property"> = True</em><a class="headerlink" href="#matplotlib.widgets.Widget.eventson" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../glossary/index.html" title="Glossary"
             >next</a> |</li>
        <li class="right" >
          <a href="units_api.html" title="units"
             >previous</a> |</li>
        <li><a href="../index.html">home</a>|&nbsp;</li>
        <li><a href="../search.html">search</a>|&nbsp;</li>
        <li><a href="../examples/index.html">examples</a>|&nbsp;</li>
        <li><a href="../gallery.html">gallery</a>|&nbsp;</li>
        <li><a href="../contents.html">docs</a> &raquo;</li>

          <li><a href="index.html" >The Matplotlib API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the matplotlib development team.
      Last updated on Jul 23, 2013.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>