加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

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

发布时间:2020-12-16 22:15:09 所属栏目:Python 来源:网络整理
导读:有没有办法在显示matplotlib图时默认自动激活“缩放到矩形”工具? import numpy as npimport matplotlib.pyplot as pltx = np.arange(-300,300)y = x**2-7*xfig = plt.figure()ax = fig.add_subplot(1,1,1)plt.plot(x,y)# Add something here to activate t

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

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()
最佳答案
这对我有用:

plt.get_current_fig_manager().toolbar.zoom()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读