如何在pyqt/matplotlib导航中以编程方式选择平移/缩放 [英] How to programmatically select pan/zoom in pyqt/matplotlib navigation
问题描述
我有一个 pyqt4 matplotlib 应用程序,当应用程序打开时,我希望图形开始(默认)到平移缩放模式.我找不到文档中有关如何以编程方式执行此操作的任何示例或线索.
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.
同样,我将如何在应用程序中启用快捷键(http://matplotlib.sourceforge.net/users/navigation_toolbar.html)
Also along this same line how would I enable the shortcut keys in my application (http://matplotlib.sourceforge.net/users/navigation_toolbar.html)
感谢您的任何建议.
科林
推荐答案
我遇到了类似的问题,在我的情况下,我使用 toolbar.zoom()
解决了它:
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
这篇关于如何在pyqt/matplotlib导航中以编程方式选择平移/缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!