2
from numpy import linspace, sin
4
from chaco.api import ArrayPlotData, HPlotContainer, Plot
5
from enable.component_editor import ComponentEditor
6
from traits.api import HasTraits, Instance
7
from traitsui.api import Item, View
9
class ContainerExample(HasTraits):
11
plot = Instance(HPlotContainer)
13
traits_view = View(Item('plot', editor=ComponentEditor(), show_label=False),
14
width=1000, height=600, resizable=True,
18
# Create the data and the PlotData object
19
x = linspace(-14, 14, 100)
21
plotdata = ArrayPlotData(x = x, y = y)
22
# Create the scatter plot
23
scatter = Plot(plotdata)
24
scatter.plot(("x", "y"), type="scatter", color="blue")
25
# Create the line plot
27
line.plot(("x", "y"), type="line", color="blue")
28
# Create a horizontal container and put the two plots inside it
29
container = HPlotContainer(scatter, line)
32
#===============================================================================
33
# demo object that is used by the demo.py application.
34
#===============================================================================
35
demo=ContainerExample()
36
if __name__ == "__main__":
37
demo.configure_traits()