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

« back to all changes in this revision

Viewing changes to examples/tutorials/scipy2008/overlapping.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
 
 
2
 
from numpy import linspace, cos, sin
3
 
 
4
 
from chaco.api import ArrayPlotData, Plot
5
 
from enable.component_editor import ComponentEditor
6
 
from traits.api import HasTraits, Instance
7
 
from traitsui.api import Item, View
8
 
 
9
 
class OverlappingExample(HasTraits):
10
 
 
11
 
    plot = Instance(Plot)
12
 
 
13
 
    traits_view = View(Item('plot', editor=ComponentEditor(), show_label=False),
14
 
                       width=800, height=600, resizable=True,
15
 
                       title="Chaco Plot")
16
 
 
17
 
    def __init__(self):
18
 
        # Create the data and the PlotData object
19
 
        x = linspace(-14, 14, 100)
20
 
        y = x/2 * sin(x)
21
 
        y2 = cos(x)
22
 
        plotdata = ArrayPlotData(x=x, y=y, y2=y2)
23
 
        # Create a Plot and associate it with the PlotData
24
 
        plot = Plot(plotdata)
25
 
        # Create a scatter plot in the Plot
26
 
        plot.plot(("x", "y"), type="scatter", color="blue")
27
 
        # Create an overlapping line plot
28
 
        plot.plot(("x", "y2"), type="line", color="red")
29
 
        self.plot = plot
30
 
 
31
 
#===============================================================================
32
 
# demo object that is used by the demo.py application.
33
 
#===============================================================================
34
 
demo = OverlappingExample()
35
 
if __name__ == "__main__":
36
 
    demo.configure_traits()
37