3
A toolbar plot is the same as a regular Plot, but also provides a
4
usually hidden drop-down toolbar with configurable buttons.
6
The toolbar appears when the mouse hovers over the top of the plot area.
8
This toolbar provides buttons for X log scale, Y log scale, Save as,
9
Copy image, Copy data, and Zoom reset.
15
from chaco.plot import Plot, ArrayPlotData
16
from chaco.api import ToolbarPlot
17
from enable.api import ComponentEditor
18
from traits.api import Instance, HasTraits
19
from traitsui.api import View, Item
22
class ExamplePlotApp(HasTraits):
26
traits_view = View(Item('plot', editor=ComponentEditor(),
27
width = 600, height = 600,
31
def __init__(self, index, series1, series2, **kw):
32
super(ExamplePlotApp, self).__init__(**kw)
33
plot_data = ArrayPlotData(index=index)
34
plot_data.set_data('series1', series1)
35
plot_data.set_data('series2', series2)
37
self.plot = ToolbarPlot(plot_data)
38
self.plot.plot(('index', 'series1'), color='auto')
39
self.plot.plot(('index', 'series2'), color='auto')
41
index = numpy.arange(1.0, 10., 0.01)
42
series1 = (100.0 + index) / (100.0 - 20*index**2 + 5.0*index**4)
43
series2 = (100.0 + index) / (100.0 - 20*index**2 + 5.0*index**3)
44
demo = ExamplePlotApp(index, series1, series2)
46
if __name__== '__main__':
47
demo.configure_traits()