python – Wonder-twin power“Zoom to rectangle”激活?

前端之家收集整理的这篇文章主要介绍了python – Wonder-twin power“Zoom to rectangle”激活?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

有没有办法在显示matplotlib图时默认自动激活“缩放到矩形”工具?

@H_404_5@import numpy as np import matplotlib.pyplot as plt x = np.arange(-300,300) y = x**2-7*x fig = plt.figure() ax = fig.add_subplot(1,1,1) plt.plot(x,y) # Add something here to activate the "Zoom to rectangle" tool? plt.show()
最佳答案
这对我有用:

@H_404_5@plt.get_current_fig_manager().toolbar.zoom()

猜你在找的Python相关文章