Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > a44f8c7e78ee9c5838c1fb080c9e7630 > files > 1621

python-matplotlib-doc-1.1.1-1mdv2010.1.noarch.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>legend &mdash; Matplotlib v1.1.1 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.1.1',
        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 v1.1.1 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="top" title="Matplotlib v1.1.1 documentation" href="../index.html" />
    <link rel="up" title="The Matplotlib API" href="index.html" />
    <link rel="next" title="mathtext" href="mathtext_api.html" />
    <link rel="prev" title="gridspec" href="gridspec_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="mathtext_api.html" title="mathtext"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="gridspec_api.html" title="gridspec"
             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="#">legend</a><ul>
<li><a class="reference internal" href="#module-matplotlib.legend"><tt class="docutils literal"><span class="pre">matplotlib.legend</span></tt></a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="gridspec_api.html"
                        title="previous chapter">gridspec</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="mathtext_api.html"
                        title="next chapter">mathtext</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/api/legend_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" size="18" />
      <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="legend">
<h1>legend<a class="headerlink" href="#legend" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-matplotlib.legend">
<span id="matplotlib-legend"></span><h2><a class="reference internal" href="#module-matplotlib.legend" title="matplotlib.legend"><tt class="xref py py-mod docutils literal"><span class="pre">matplotlib.legend</span></tt></a><a class="headerlink" href="#module-matplotlib.legend" title="Permalink to this headline">¶</a></h2>
<p>The legend module defines the Legend class, which is responsible for
drawing legends associated with axes and/or figures.</p>
<p>The Legend class can be considered as a container of legend handles
and legend texts. Creation of corresponding legend handles from the
plot elements in the axes or figures (e.g., lines, patches, etc.) are
specified by the handler map, which defines the mapping between the
plot elements and the legend handlers to be used (the default legend
handlers are defined in the <tt class="xref py py-mod docutils literal"><span class="pre">legend_handler</span></tt> module). Note
that not all kinds of artist are supported by the legend yet (See
<a class="reference internal" href="../users/legend_guide.html#plotting-guide-legend"><em>Legend guide</em></a> for more information).</p>
<dl class="class">
<dt id="matplotlib.legend.DraggableLegend">
<em class="property">class </em><tt class="descclassname">matplotlib.legend.</tt><tt class="descname">DraggableLegend</tt><big>(</big><em>legend</em>, <em>use_blit=False</em>, <em>update='loc'</em><big>)</big><a class="headerlink" href="#matplotlib.legend.DraggableLegend" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">matplotlib.offsetbox.DraggableOffsetBox</span></tt></p>
<dl class="docutils">
<dt>update <span class="classifier-delimiter">:</span> <span class="classifier">If &#8220;loc&#8221;, update <em>loc</em> parameter of</span></dt>
<dd>legend upon finalizing. If &#8220;bbox&#8221;, update
<em>bbox_to_anchor</em> parameter.</dd>
</dl>
<dl class="method">
<dt id="matplotlib.legend.DraggableLegend.artist_picker">
<tt class="descname">artist_picker</tt><big>(</big><em>legend</em>, <em>evt</em><big>)</big><a class="headerlink" href="#matplotlib.legend.DraggableLegend.artist_picker" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.legend.DraggableLegend.finalize_offset">
<tt class="descname">finalize_offset</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.DraggableLegend.finalize_offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="matplotlib.legend.Legend">
<em class="property">class </em><tt class="descclassname">matplotlib.legend.</tt><tt class="descname">Legend</tt><big>(</big><em>parent</em>, <em>handles</em>, <em>labels</em>, <em>loc=None</em>, <em>numpoints=None</em>, <em>markerscale=None</em>, <em>scatterpoints=3</em>, <em>scatteryoffsets=None</em>, <em>prop=None</em>, <em>pad=None</em>, <em>labelsep=None</em>, <em>handlelen=None</em>, <em>handletextsep=None</em>, <em>axespad=None</em>, <em>borderpad=None</em>, <em>labelspacing=None</em>, <em>handlelength=None</em>, <em>handleheight=None</em>, <em>handletextpad=None</em>, <em>borderaxespad=None</em>, <em>columnspacing=None</em>, <em>ncol=1</em>, <em>mode=None</em>, <em>fancybox=None</em>, <em>shadow=None</em>, <em>title=None</em>, <em>bbox_to_anchor=None</em>, <em>bbox_transform=None</em>, <em>frameon=None</em>, <em>handler_map=None</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="artist_api.html#matplotlib.artist.Artist" title="matplotlib.artist.Artist"><tt class="xref py py-class docutils literal"><span class="pre">matplotlib.artist.Artist</span></tt></a></p>
<p>Place a legend on the axes at location loc.  Labels are a
sequence of strings and loc can be a string or an integer
specifying the legend location</p>
<p>The location codes are:</p>
<div class="highlight-python"><pre>'best'         : 0, (only implemented for axis legends)
'upper right'  : 1,
'upper left'   : 2,
'lower left'   : 3,
'lower right'  : 4,
'right'        : 5,
'center left'  : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center'       : 10,</pre>
</div>
<p>loc can be a tuple of the noramilzed coordinate values with
respect its parent.</p>
<blockquote>
<div><ul class="simple">
<li><em>parent</em> : the artist that contains the legend</li>
<li><em>handles</em> : a list of artists (lines, patches) to be added to the legend</li>
<li><em>labels</em> : a list of strings to label the legend</li>
</ul>
<p>Optional keyword arguments:</p>
<table border="1" class="docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Keyword</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>loc</td>
<td>a location code</td>
</tr>
<tr><td>prop</td>
<td>the font property</td>
</tr>
<tr><td>markerscale</td>
<td>the relative size of legend markers vs. original</td>
</tr>
<tr><td>numpoints</td>
<td>the number of points in the legend for line</td>
</tr>
<tr><td>scatterpoints</td>
<td>the number of points in the legend for scatter plot</td>
</tr>
<tr><td>scatteryoffsets</td>
<td>a list of yoffsets for scatter symbols in legend</td>
</tr>
<tr><td>frameon</td>
<td>if True, draw a frame around the legend. If None, use rc</td>
</tr>
<tr><td>fancybox</td>
<td>if True, draw a frame with a round fancybox.  If None, use rc</td>
</tr>
<tr><td>shadow</td>
<td>if True, draw a shadow behind legend</td>
</tr>
<tr><td>ncol</td>
<td>number of columns</td>
</tr>
<tr><td>borderpad</td>
<td>the fractional whitespace inside the legend border</td>
</tr>
<tr><td>labelspacing</td>
<td>the vertical space between the legend entries</td>
</tr>
<tr><td>handlelength</td>
<td>the length of the legend handles</td>
</tr>
<tr><td>handleheight</td>
<td>the length of the legend handles</td>
</tr>
<tr><td>handletextpad</td>
<td>the pad between the legend handle and text</td>
</tr>
<tr><td>borderaxespad</td>
<td>the pad between the axes and legend border</td>
</tr>
<tr><td>columnspacing</td>
<td>the spacing between columns</td>
</tr>
<tr><td>title</td>
<td>the legend title</td>
</tr>
<tr><td>bbox_to_anchor</td>
<td>the bbox that the legend will be anchored.</td>
</tr>
<tr><td>bbox_transform</td>
<td>the transform for the bbox. transAxes if None.</td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>The pad and spacing parameters are measured in font-size units.  E.g.,
a fontsize of 10 points and a handlelength=5 implies a handlelength of
50 points.  Values from rcParams will be used if None.</p>
<p>Users can specify any arbitrary location for the legend using the
<em>bbox_to_anchor</em> keyword argument. bbox_to_anchor can be an instance
of BboxBase(or its derivatives) or a tuple of 2 or 4 floats.
See <a class="reference internal" href="#matplotlib.legend.Legend.set_bbox_to_anchor" title="matplotlib.legend.Legend.set_bbox_to_anchor"><tt class="xref py py-meth docutils literal"><span class="pre">set_bbox_to_anchor()</span></tt></a> for more detail.</p>
<p>The legend location can be specified by setting <em>loc</em> with a tuple of
2 floats, which is interpreted as the lower-left corner of the legend
in the normalized axes coordinate.</p>
<dl class="method">
<dt id="matplotlib.legend.Legend.contains">
<tt class="descname">contains</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.contains" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.draggable">
<tt class="descname">draggable</tt><big>(</big><em>state=None</em>, <em>use_blit=False</em>, <em>update='loc'</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.draggable" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the draggable state &#8211; if state is</p>
<blockquote>
<div><ul class="simple">
<li>None : toggle the current state</li>
<li>True : turn draggable on</li>
<li>False : turn draggable off</li>
</ul>
</div></blockquote>
<p>If draggable is on, you can drag the legend on the canvas with
the mouse.  The DraggableLegend helper instance is returned if
draggable is on.</p>
<p>The update parameter control which parameter of the legend changes
when dragged. If update is &#8220;loc&#8221;, the <em>loc</em> paramter of the legend
is changed. If &#8220;bbox&#8221;, the <em>bbox_to_anchor</em> parameter is changed.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.draw">
<tt class="descname">draw</tt><big>(</big><em>artist</em>, <em>renderer</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.draw" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw everything that belongs to the legend</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.draw_frame">
<tt class="descname">draw_frame</tt><big>(</big><em>b</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.draw_frame" title="Permalink to this definition">¶</a></dt>
<dd><p>b is a boolean.  Set draw frame to b</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_bbox_to_anchor">
<tt class="descname">get_bbox_to_anchor</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_bbox_to_anchor" title="Permalink to this definition">¶</a></dt>
<dd><p>return the bbox that the legend will be anchored</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_children">
<tt class="descname">get_children</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_children" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of child artists</p>
</dd></dl>

<dl class="classmethod">
<dt id="matplotlib.legend.Legend.get_default_handler_map">
<em class="property">classmethod </em><tt class="descname">get_default_handler_map</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_default_handler_map" title="Permalink to this definition">¶</a></dt>
<dd><p>A class method that returns the default handler map.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_frame">
<tt class="descname">get_frame</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_frame" title="Permalink to this definition">¶</a></dt>
<dd><p>return the Rectangle instance used to frame the legend</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_frame_on">
<tt class="descname">get_frame_on</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_frame_on" title="Permalink to this definition">¶</a></dt>
<dd><p>Get whether the legend box patch is drawn</p>
</dd></dl>

<dl class="staticmethod">
<dt id="matplotlib.legend.Legend.get_legend_handler">
<em class="property">static </em><tt class="descname">get_legend_handler</tt><big>(</big><em>legend_handler_map</em>, <em>orig_handle</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_legend_handler" title="Permalink to this definition">¶</a></dt>
<dd><p>return a legend handler from <em>legend_handler_map</em> that
corresponds to <em>orig_handler</em>.</p>
<p><em>legend_handler_map</em> should be a dictionary object (that is
returned by the get_legend_handler_map method).</p>
<p>It first checks if the <em>orig_handle</em> itself is a key in the
<em>legend_hanler_map</em> and return the associated value.
Otherwise, it checks for each of the classes in its
method-resolution-order. If no matching key is found, it
returns None.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_legend_handler_map">
<tt class="descname">get_legend_handler_map</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_legend_handler_map" title="Permalink to this definition">¶</a></dt>
<dd><p>return the handler map.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_lines">
<tt class="descname">get_lines</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_lines" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of lines.Line2D instances in the legend</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_patches">
<tt class="descname">get_patches</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_patches" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of patch instances in the legend</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_texts">
<tt class="descname">get_texts</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_texts" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of text.Text instance in the legend</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_title">
<tt class="descname">get_title</tt><big>(</big><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_title" title="Permalink to this definition">¶</a></dt>
<dd><p>return Text instance for the legend title</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.get_window_extent">
<tt class="descname">get_window_extent</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.get_window_extent" title="Permalink to this definition">¶</a></dt>
<dd><p>return a extent of the the legend</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.set_bbox_to_anchor">
<tt class="descname">set_bbox_to_anchor</tt><big>(</big><em>bbox</em>, <em>transform=None</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.set_bbox_to_anchor" title="Permalink to this definition">¶</a></dt>
<dd><p>set the bbox that the legend will be anchored.</p>
<p><em>bbox</em> can be a BboxBase instance, a tuple of [left, bottom,
width, height] in the given transform (normalized axes
coordinate if None), or a tuple of [left, bottom] where the
width and height will be assumed to be zero.</p>
</dd></dl>

<dl class="classmethod">
<dt id="matplotlib.legend.Legend.set_default_handler_map">
<em class="property">classmethod </em><tt class="descname">set_default_handler_map</tt><big>(</big><em>handler_map</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.set_default_handler_map" title="Permalink to this definition">¶</a></dt>
<dd><p>A class method to set the default handler map.</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.set_frame_on">
<tt class="descname">set_frame_on</tt><big>(</big><em>b</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.set_frame_on" title="Permalink to this definition">¶</a></dt>
<dd><p>Set whether the legend box patch is drawn</p>
<p>ACCEPTS: [ <em>True</em> | <em>False</em> ]</p>
</dd></dl>

<dl class="method">
<dt id="matplotlib.legend.Legend.set_title">
<tt class="descname">set_title</tt><big>(</big><em>title</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.set_title" title="Permalink to this definition">¶</a></dt>
<dd><p>set the legend title</p>
</dd></dl>

<dl class="classmethod">
<dt id="matplotlib.legend.Legend.update_default_handler_map">
<em class="property">classmethod </em><tt class="descname">update_default_handler_map</tt><big>(</big><em>handler_map</em><big>)</big><a class="headerlink" href="#matplotlib.legend.Legend.update_default_handler_map" title="Permalink to this definition">¶</a></dt>
<dd><p>A class method to update the default handler map.</p>
</dd></dl>

</dd></dl>

</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="mathtext_api.html" title="mathtext"
             >next</a> |</li>
        <li class="right" >
          <a href="gridspec_api.html" title="gridspec"
             >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 2008, John Hunter, Darren Dale, Michael Droettboom.
      Last updated on Oct 04, 2012.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>