Sophie

Sophie

distrib > Mandriva > current > i586 > by-pkgid > ae0a4f27f26602dc31c3bf35e18b5b19 > files > 748

python-enthought-chaco-3.4.0-2mdv2010.2.i586.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>Commonly Used Modules and Classes &mdash; Chaco v3.4.0 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '3.4.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="shortcut icon" href="_static/et.ico"/>
    <link rel="top" title="Chaco v3.4.0 documentation" href="index.html" />
    <link rel="up" title="Programmer’s Reference" href="programmers_reference.html" />
    <link rel="next" title="Data Sources" href="api/data_sources.html" />
    <link rel="prev" title="Architecture Overview" href="architecture_overview.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="api/data_sources.html" title="Data Sources"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="architecture_overview.html" title="Architecture Overview"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Chaco v3.4.0 documentation</a> &raquo;</li>
          <li><a href="programmers_reference.html" accesskey="U">Programmer&#8217;s Reference</a> &raquo;</li>
  
    <li><a href="#">Commonly Used Modules and Classes</a></li>
  

      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="commonly-used-modules-and-classes">
<span id="modules-and-classes"></span><h1>Commonly Used Modules and Classes<a class="headerlink" href="#commonly-used-modules-and-classes" title="Permalink to this headline">¶</a></h1>
<div class="section" id="base-classes">
<h2>Base Classes<a class="headerlink" href="#base-classes" title="Permalink to this headline">¶</a></h2>
<p class="rubric">Plot Component</p>
<p>All visual components in Chaco subclass from <tt class="xref py py-class docutils literal"><span class="pre">PlotComponent</span></tt>. It defines
all of the common visual attributes like background color, border styles and
color, and whether the component is visible. (Actually, most of these visual
attributes are inherited from the Enable drawing framework.) More importantly,
it provides the base behaviors for participating in layout, handling event
dispatch to tools and overlays, and drawing various layers in the correct order.
Subclasses almost never need to override or customize these base behaviors, but
if they do, there are several easy extension points.</p>
<p>PlotComponent is a subclass of Enable <tt class="xref py py-class docutils literal"><span class="pre">Component</span></tt>. It has its
own default drawing order. It redefines the inherited traits <tt class="xref py py-attr docutils literal"><span class="pre">draw_order</span></tt>
and <tt class="xref py py-attr docutils literal"><span class="pre">draw_layer</span></tt>, but it doesn&#8217;t define any new traits. Therefore, you
may need to refer to the API documentation for Enable Component,
even when you have subclassed Chaco PlotComponent.</p>
<p>If you subclass PlotComponent, you need to implement <tt class="xref py py-meth docutils literal"><span class="pre">do_layout()</span></tt>,
if you want to size the component correctly.</p>
</div>
<div class="section" id="data-objects">
<h2>Data Objects<a class="headerlink" href="#data-objects" title="Permalink to this headline">¶</a></h2>
<p class="rubric">Data Source</p>
<p>A data source is a wrapper object for the actual data that it will be
handling. It provides methods for retrieving data, estimating a size of the
dataset, indications about the dimensionality of the data, a place for metadata
(such as selections and annotations), and events that fire when the data gets
changed. There are two primary reasons for a data source class:</p>
<ul>
<li><p class="first">It provides a way for different plotting objects to reference the same data.</p>
</li>
<li><p class="first">It defines the interface for embedding Chaco into an existing application.
In most cases, the standard ArrayDataSource will suffice.</p>
<blockquote>
<div><p><em>Interface:</em> <tt class="xref py py-class docutils literal"><span class="pre">AbstractDataSource</span></tt></p>
<p><em>Subclasses:</em> <tt class="xref py py-class docutils literal"><span class="pre">ArrayDataSource</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">MultiArrayDataSource</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">PointDataSource</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">GridDataSource</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">ImageData</span></tt></p>
</div></blockquote>
</li>
</ul>
<p class="rubric">Data Range</p>
<p>A data range expresses bounds on data space of some dimensionality. The simplest
data range is just a set of two scalars representing (low, high) bounds in 1-D.
One of the important aspects of data ranges is that their bounds can be set to
<tt class="docutils literal"><span class="pre">auto</span></tt>, which means that they automatically scale to fit their associated
datasources. (Each data source can be associated with multiple ranges,
and each data range can be associated with multiple data sources.)</p>
<blockquote>
<div><p><em>Interface</em>: <tt class="xref py py-class docutils literal"><span class="pre">AbstractDataRange</span></tt></p>
<p><em>Subclasses</em>: <tt class="xref py py-class docutils literal"><span class="pre">BaseDataRange</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">DataRange1D</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">DataRange2D</span></tt></p>
</div></blockquote>
<p class="rubric">Data Source</p>
<p>A data source is an object that supplies data to Chaco. For the most part, a
data source looks like an array of values, with an optional mask and metadata.</p>
<blockquote>
<div><p><em>Interface</em>: :class:AbstractDataSource`</p>
<p><em>Subclasses</em>: <tt class="xref py py-class docutils literal"><span class="pre">ArrayDataSource</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">DataContextDataSource</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">GridDataSource</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">ImageData</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">MultiArrayDataSource</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">PointDataSource</span></tt></p>
</div></blockquote>
<p>The <tt class="xref py py-attr docutils literal"><span class="pre">metadata</span></tt> trait attribute is a dictionary where you can stick
stuff for other tools to find, without inserting it in the actual data.</p>
<p>Events that are fired on data sources are:</p>
<blockquote>
<div><ul class="simple">
<li><tt class="xref py py-attr docutils literal"><span class="pre">data_changed</span></tt></li>
<li><tt class="xref py py-attr docutils literal"><span class="pre">bounds_changed</span></tt></li>
<li><tt class="xref py py-attr docutils literal"><span class="pre">metadata_changed</span></tt></li>
</ul>
</div></blockquote>
<p class="rubric">Mapper</p>
<p>Mappers perform the job of mapping a data space region to screen space, and
vice versa. Bounds on mappers are set by data range objects.</p>
<blockquote>
<div><p><em>Interface</em>: <tt class="xref py py-class docutils literal"><span class="pre">AbstractMapper</span></tt></p>
<p><em>Subclasses</em>: <tt class="xref py py-class docutils literal"><span class="pre">Base1DMapper</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">LinearMapper</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">LogMapper</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">GridMapper</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">PolarMapper</span></tt></p>
</div></blockquote>
</div>
<div class="section" id="containers">
<h2>Containers<a class="headerlink" href="#containers" title="Permalink to this headline">¶</a></h2>
<p class="rubric">PlotContainer</p>
<p><tt class="xref py py-class docutils literal"><span class="pre">PlotContainer</span></tt> is Chaco&#8217;s way of handling layout. Because it logically
partitions the screen space, it also serves as a way for efficient event
dispatch. It is very similar to sizers or layout grids in GUI toolkits like
WX. Containers are subclasses of PlotComponent, thus allowing them to
be nested. <tt class="xref py py-class docutils literal"><span class="pre">BasePlotContainer</span></tt> implements the logic to correctly render
and dispatch events to sub-components, while its subclasses implement the
different layout calculations.</p>
<p>A container gets the preferred size from its components, and tries to allocate
space for them. Non-resizeable components get their required size; whatever is
left over is divided among the resizeable components.</p>
<p>Chaco currently has three types of containers,
described in the following sections.</p>
<blockquote>
<div><p><em>Interface</em>: <tt class="xref py py-class docutils literal"><span class="pre">BasePlotContainer</span></tt></p>
<p><em>Subclasses</em>: <tt class="xref py py-class docutils literal"><span class="pre">OverlayPlotContainer</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">HPlotContainer</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">VPlotContainer</span></tt>, <tt class="xref py py-class docutils literal"><span class="pre">GridPlotContainer</span></tt></p>
</div></blockquote>
<p>The listed subclasses are defined in the module
<tt class="xref py py-mod docutils literal"><span class="pre">enthought.chaco.plot_containers</span></tt>.</p>
</div>
<div class="section" id="renderers">
<h2>Renderers<a class="headerlink" href="#renderers" title="Permalink to this headline">¶</a></h2>
<p>Plot renderers are the classes that actually draw a type of plot.</p>
<blockquote>
<div><p><em>Interface</em>: <tt class="xref py py-class docutils literal"><span class="pre">AbstractPlotRenderer</span></tt>
<em>Subclasses</em>:</p>
<blockquote>
<div><ul class="simple">
<li><tt class="xref py py-class docutils literal"><span class="pre">BarPlot</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">Base2DPlot</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">ContourLinePlot</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ContourPolyPlot</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ImagePlot</span></tt>: displays an image file, or color-maps scalar
data to make an image</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">CMapImagePlot</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">BaseXYPlot</span></tt>: This class is often emulated by writers of other
plot renderers, but renderers don&#8217;t <em>need</em> to be structured this way.
By convention, many have a <tt class="xref py py-meth docutils literal"><span class="pre">hittest()</span></tt> method. They <em>do</em> need
to implement <tt class="xref py py-meth docutils literal"><span class="pre">map_screen()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">map_data()</span></tt>, and <tt class="xref py py-meth docutils literal"><span class="pre">map_index()</span></tt>
from <tt class="xref py py-class docutils literal"><span class="pre">AbstractPlotRenderer</span></tt>.<ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">LinePlot</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">ErrorBarPlot</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">PolygonPlot</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">FilledLinePlot</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ScatterPlot</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">ColormappedScatterPlot</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ColorBar</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">PolarLineRenderer</span></tt>: NOTE: doesn&#8217;t play well with others</li>
</ul>
</li>
</ul>
</div></blockquote>
</div></blockquote>
<p>You can use these classes to compose more interesting plots.</p>
<p>The module <tt class="xref py py-mod docutils literal"><span class="pre">enthought.chaco.plot_factory</span></tt> contains various convenience
functions for creating plots, which simplify the set-up.</p>
<p>The <tt class="xref py py-class docutils literal"><span class="pre">enthought.chaco.plot.Plot</span></tt> class (called &#8220;capital P Plot&#8221; when
speaking) represents what the user usually thinks of as a &#8220;plot&#8221;: a set of data,
renderers, and axes in a single screen region. It is a subclass of
<tt class="xref py py-class docutils literal"><span class="pre">DataView</span></tt>.</p>
</div>
<div class="section" id="tools">
<h2>Tools<a class="headerlink" href="#tools" title="Permalink to this headline">¶</a></h2>
<p>Tools attach to a component, which gives events to the tool.</p>
<p>All tools subclass from Enable&#8217;s <tt class="xref py py-class docutils literal"><span class="pre">BaseTool</span></tt>, which is in turn an Enable
<tt class="xref py py-class docutils literal"><span class="pre">Interactor</span></tt>.  Do not try to make tools that draw: use an overlay for
that.</p>
<p>Some tool subclasses exist in both Enable and Chaco, because they were created
first in Chaco, and then moved into Enable.</p>
<blockquote>
<div><p><em>Interface</em>: <tt class="xref py py-class docutils literal"><span class="pre">BaseTool</span></tt>
<em>Subclasses</em>:</p>
<blockquote>
<div><ul class="simple">
<li><tt class="xref py py-class docutils literal"><span class="pre">BroadcasterTool</span></tt>: Keeps a list of other tools, and broadcasts
events it receives to all those tools.</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">DataPrinter</span></tt>: Prints the data-space position of the point
under the cursor.</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">enthought.enable.tools.api.DragTool</span></tt>: Enable base class
for tools that do dragging.<ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">MoveTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ResizeTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ViewportPanTool</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">enthought.chaco.tools.api.DragTool</span></tt>: Chaco base class
for tools that do dragging.<ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">BaseCursorTool</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">CursorTool1D</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">CursorTool2D</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">DataLabelTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">DragZoom</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">LegendTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">MoveTool</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">DrawPointsTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">HighlightTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">HoverTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">ImageInspectorTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">LineInspector</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">PanTool</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">TrackingPanTool</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">PointMarker</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">SaveTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">SelectTool</span></tt><ul>
<li><tt class="xref py py-class docutils literal"><span class="pre">ScatterInspector</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">SelectableLegend</span></tt></li>
</ul>
</li>
<li><tt class="xref py py-class docutils literal"><span class="pre">enthought.enable.tools.api.TraitsTool</span></tt></li>
<li><tt class="xref py py-class docutils literal"><span class="pre">enthought.chaco.tools.api.TraitsTool</span></tt></li>
</ul>
</div></blockquote>
</div></blockquote>
<p>DragTool is a base class for tools that do dragging.</p>
<p>Other tools do things like panning, moving, highlighting, line segments, range selection, drag zoom, move data labels, scatter inspection, Traits UI.</p>
</div>
<div class="section" id="overlays">
<h2>Overlays<a class="headerlink" href="#overlays" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="miscellaneous">
<h2>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline">¶</a></h2>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/e-logo-rev.png" alt="Logo"/>
            </a></p>
<h3>Page Contents</h3>
<ul>
<li><a class="reference internal" href="#">Commonly Used Modules and Classes</a><ul>
<li><a class="reference internal" href="#base-classes">Base Classes</a></li>
<li><a class="reference internal" href="#data-objects">Data Objects</a></li>
<li><a class="reference internal" href="#containers">Containers</a></li>
<li><a class="reference internal" href="#renderers">Renderers</a></li>
<li><a class="reference internal" href="#tools">Tools</a></li>
<li><a class="reference internal" href="#overlays">Overlays</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
</ul>
</li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/modules_and_classes.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="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="api/data_sources.html" title="Data Sources"
             >next</a></li>
        <li class="right" >
          <a href="architecture_overview.html" title="Architecture Overview"
             >previous</a> |</li>
        <li><a href="index.html">Chaco v3.4.0 documentation</a> &raquo;</li>
          <li><a href="programmers_reference.html" >Programmer&#8217;s Reference</a> &raquo;</li>
  
    <li><a href="#">Commonly Used Modules and Classes</a></li>
  

      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2008, Enthought, Inc..
      Last updated on Mar 02, 2011.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>