2
from numpy import linspace, sin
3
from chaco.api import ArrayPlotData, Plot
4
from enable.component_editor import ComponentEditor
5
from traits.api import HasTraits, Instance
6
from traitsui.api import Item, View
8
class LinePlot(HasTraits):
13
Item('plot', editor=ComponentEditor(),
15
width=500, height=500,
20
# Create the data and the PlotData object
21
x = linspace(-14, 14, 100)
23
plotdata = ArrayPlotData(x = x, y = y)
24
# Create a Plot and associate it with the PlotData
26
# Create a line plot in the Plot
27
plot.plot(("x", "y"), type="line", color="blue")
29
plot.title = "sin(x) * x^3"
30
# Assign it to our self.plot attribute
33
#===============================================================================
34
# demo object that is used by the demo.py application.
35
#===============================================================================
37
if __name__ == "__main__":
38
demo.configure_traits()