~ubuntu-branches/ubuntu/utopic/python-chaco/utopic

« back to all changes in this revision

Viewing changes to examples/tutorials/tutorial11.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2014-06-01 17:04:08 UTC
  • mfrom: (7.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20140601170408-m86xvdjd83a4qon0
Tags: 4.4.1-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
 - Let the binary-predeb target work on the usr/lib/python* directory
   as we don't have usr/share/pyshared anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Tutorial 11: Demonstration of index and value.
2
 
 
3
 
We are going to change the orientation of the right_plot, but all of our
4
 
dataspace linking will still work. This is why it's good to work with index and
5
 
value instead of hardcoding to X and Y. We'll also add another LineInspector to
6
 
each plot to form a full crosshair.
7
 
"""
8
 
 
9
 
from chaco.tools.api import LineInspector
10
 
 
11
 
from tutorial10b import PlotExample3
12
 
 
13
 
 
14
 
class PlotExample4(PlotExample3):
15
 
    def _container_default(self):
16
 
        container = super(PlotExample4, self)._container_default()
17
 
 
18
 
        rplot, lplot = self.right_plot, self.left_plot
19
 
        rplot.orientation = "v"
20
 
        rplot.hgrid.mapper = rplot.index_mapper
21
 
        rplot.vgrid.mapper = rplot.value_mapper
22
 
        rplot.y_axis.mapper = rplot.index_mapper
23
 
        rplot.x_axis.mapper = rplot.value_mapper
24
 
 
25
 
 
26
 
        lplot.overlays.append(LineInspector(component=lplot,
27
 
             axis="value", write_metadata=True, is_listener=True, color="blue"))
28
 
        lplot.overlays.append(LineInspector(component=lplot,
29
 
             axis="value", write_metadata=True, is_listener=True, color="blue"))
30
 
 
31
 
        rplot.overlays.append(LineInspector(component=rplot,
32
 
             axis="value", write_metadata=True, is_listener=True, color="blue"))
33
 
        rplot.overlays.append(LineInspector(component=rplot,
34
 
             axis="value", write_metadata=True, is_listener=True, color="blue"))
35
 
 
36
 
        return container
37
 
 
38
 
 
39
 
demo = PlotExample4()
40
 
 
41
 
if __name__ == "__main__":
42
 
    demo.configure_traits()