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)
17
# Create the data and the PlotData object
18
x = linspace(-14, 14, 100)
20
plotdata = ArrayPlotData(x = x, y = y)
21
# Create the scatter plot
22
scatter = Plot(plotdata)
23
scatter.plot(("x", "y"), type="scatter", color="blue")
24
# Create the line plot
26
line.plot(("x", "y"), type="line", color="blue")
27
# Create a horizontal container and put the two plots inside it
28
container = HPlotContainer(scatter, line)
30
scatter.padding_right = 0
32
line.y_axis.orientation = "right"
36
#===============================================================================
37
# demo object that is used by the demo.py application.
38
#===============================================================================
39
demo=ContainerExample()
40
if __name__ == "__main__":
41
demo.configure_traits()