ginga
ginga copied to clipboard
Pan/Zoom with matplotlib
I've been playing around with example4_mpl.py but the mpl toolbar controls didn't work out of the box. I tracked down a problem to the start_pan and end_pan methods in transform.py passing a string as the 'event' to ms_pan in Bindings.py instead of an event object. I worked around this by changing 'event.state' to just 'event' in ms_pan (to at least get panning working). But then I encountered some strange behavior with the overplotted graphics. Each time the canvas is panned or zoomed, the overplots creep towards the origin. The attached screenshots show the image upon opening, and then after a whole bunch of zooming and panning and returning the original position.
@retroexpress, I think the matplotlib toolbox does not work correctly. As an alternative you can use the native ginga zooming controls (see the quick reference in the documentation for details).
That is certainly something I'd like to get working, though. I think the information necessary is how to connect callbacks for all the matplotlib tool events to methods in the ImageViewZoom
class in this file. Do you have any information about accessing these events?