python - Chaco MultiLinePlot - unable to get simple plot to display, wondering if package broken? -
i trying create multi line plot display multiple time series data (voltages) 2d numpy array. have started trying plot 2 lines ten data points 2x10 array, not able work without getting large amount of error output unable debug.
imports:
import numpy traits.api import hastraits, instance traitsui.api import view, item chaco.api import multilineplot, arraydatasource, multiarraydatasource enable.component_editor import componenteditor
test array:
test_array = numpy.random.rand(10,2)
display class:
class multi_line_graph(hastraits): plot = instance(multilineplot) traits_view = view( item('plot',editor=componenteditor(), show_label=false), width=1024, height=768, resizable=true, title="eeg preview") def __init__(self, my_data): super(multi_line_graph, self).__init__() x = arraydatasource(numpy.arange(1, my_data.shape[0])) y = my_data.transpose() #since data columnwise y = multiarraydatasource(y) yidx = arraydatasource(numpy.arange(y.get_shape()[0])) plot = multilineplot(index=x, yindex=yidx, value=y) self.plot = plot
create instance of class:
my_graph = multi_line_graph(test_array)
display (configure traits):
my_graph.configure_traits()
then window appear hangs , crashes python kernel , error displayed in shell:
exception occurred in traits notification handler object: <chaco.multi_line_plot.multilineplot object @ 0x000000000d0cfd58>, trait: bounds_items, old value: <undefined>, new value: <traits.trait_handlers.traitlistevent object @ 0x000000000d18c908> traceback (most recent call last): file "c:\users\pzl46097\appdata\local\enthought\canopy\user\lib\site-packages\traits\trait_notifiers.py", line 340, in __call__ self.handler( *args ) file "c:\users\pzl46097\appdata\local\enthought\canopy\user\lib\site-packages\chaco\base_xy_plot.py", line 613, in _bounds_items_changed self._update_mappers() file "c:\users\pzl46097\appdata\local\enthought\canopy\user\lib\site-packages\chaco\base_xy_plot.py", line 594, in _update_mappers x_mapper.screen_bounds = (x, x2) attributeerror: 'nonetype' object has no attribute 'screen_bounds' exception occurred in traits notification handler object: <chaco.multi_line_plot.multilineplot object @ 0x000000000d0cfd58>, trait: bounds_items, old value: <undefined>, new value: <traits.trait_handlers.traitlistevent object @ 0x000000000d0c4c88> traceback (most recent call last): file "c:\users\pzl46097\appdata\local\enthought\canopy\user\lib\site-packages\traits\trait_notifiers.py", line 340, in __call__ self.handler( *args ) file "c:\users\pzl46097\appdata\local\enthought\canopy\user\lib\site-packages\chaco\base_xy_plot.py", line 613, in _bounds_items_changed self._update_mappers() file "c:\users\pzl46097\appdata\local\enthought\canopy\user\lib\site-packages\chaco\base_xy_plot.py", line 594, in _update_mappers x_mapper.screen_bounds = (x, x2) attributeerror: 'nonetype' object has no attribute 'screen_bounds' exception occurred in traits notification handler. please check log file details.
i don't know means. have read , re-read api documentation at:
http://docs.enthought.com/chaco/api/renderers.html#multilineplot
as user guide documents at:
http://docs.enthought.com/chaco/user_manual/plot_types.html#multi-line-plot
but there doesn't seem other documentation on class. wondering if not maintained , may broken or if doing wrong (i may have been using chaco 1 week , library new me, oop in python in general).
many in advance help..
Comments
Post a Comment