Zooming on a ColorBar raises NotImplemented error
Panning the colorbar works fine but trying to zoom on the colorbar raises an error. See below for the exact traceback.
This issue might be related to https://github.com/enthought/chaco/issues/5
(empty_py3_env)examples (master)$ python demo/basic/zoomable_colorbar.py
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/array_data_source.py:123: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
self._data = newdata
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/axis.py:498: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
for tickpos in mapped_tick_positions]))
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/axis.py:499: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
self._tick_label_list = tick_list
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/axis.py:500: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
self._tick_label_positions = self._tick_positions
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/kiva/fonttools/font_manager.py:1308: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/kiva/fonttools/font_manager.py:1318: UserWarning: findfont: Could not match (['Bitstream Vera Sans'], 'normal', None, 'normal', 500, 10.0). Returning /Library/Fonts/Andale Mono.ttf
UserWarning)
/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/kiva/fonttools/font_manager.py:1318: UserWarning: findfont: Could not match (['Bitstream Vera Sans'], 'normal', None, 'normal', 500, 16.0). Returning /Library/Fonts/Andale Mono.ttf
UserWarning)
Traceback (most recent call last):
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/qt4/base_window.py", line 228, in wheelEvent
self.handler.wheelEvent(event)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/qt4/base_window.py", line 118, in wheelEvent
self._enable_window._handle_mouse_event("mouse_wheel", event)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/abstract_window.py", line 349, in _handle_mouse_event
self.component.dispatch(mouse_event, event_name)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/component.py", line 918, in dispatch
self._new_dispatch(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/component.py", line 958, in _new_dispatch
self._dispatch_stateful_event(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/container.py", line 514, in _dispatch_stateful_event
component.dispatch(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/component.py", line 918, in dispatch
self._new_dispatch(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/component.py", line 953, in _new_dispatch
overlay.dispatch(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/component.py", line 918, in dispatch
self._new_dispatch(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/component.py", line 958, in _new_dispatch
self._dispatch_stateful_event(event, suffix)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/enable/base_tool.py", line 133, in _dispatch_stateful_event
handler(event)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/tools/better_zoom.py", line 273, in normal_mouse_wheel
self.zoom_in()
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/tools/better_zoom.py", line 140, in zoom_in
self._do_zoom(new_index_factor, new_value_factor)
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/tools/better_zoom.py", line 88, in _do_zoom
x = x_map.map_data(location[0])
File "/Users/rahulporuri/.edm/envs/empty_py3_env/lib/python3.6/site-packages/chaco/abstract_colormap.py", line 43, in map_data
raise NotImplementedError()
NotImplementedError
In addition to basic/zoomable_colorbar.py, also affects nonlinear_color_mapping.py
This looks like a fundamental incompatibility with the zoom tool and the colorbar. The zoom tool expects to be able to zoom in both index and value directions, but value is not particularly meaningful here - colorbar probably should subclass from the 1D plot classes. In any case, the colorbar for convenience uses the value mapper as a synonym for the color mapper and as a result the zoom tries to use it as a linear mapper, which doesn't work.
Proposed fixes:
- when in range mode, don't try to adjust coordinates in the non-zooming axis.
- maybe we just need a 1D zoom tool rather than a range mode
- maybe we need to re-write the zoom tools (again!)