Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically select pan/zoom in pyqt/matplotlib navigation

I have a pyqt4 matplotlib application and I would like the figure to start out (default) to the pan zoom mode when the application opens. I can't find any example or clue from the documentation on how to do this programmatically.

Also along this same line how would I enable the shortcut keys in my application (http://matplotlib.sourceforge.net/users/navigation_toolbar.html)

Thanks for any suggestions.

Colin

like image 407
Colin Talbert Avatar asked Apr 12 '12 23:04

Colin Talbert


1 Answers

I had a similar issue and in my case I solved it by using toolbar.zoom():

import pylab

plt.Figure()
thismanager = get_current_fig_manager()
thismanager.toolbar.zoom()

In that case the figure will appear with the zoom tool already selected

like image 159
maupertius Avatar answered Oct 09 '22 13:10

maupertius