python_matplotlib自动关闭图表显示窗口(python画图自动关闭窗口)

网友投稿 868 2022-08-30


python_matplotlib自动关闭图表显示窗口(python画图自动关闭窗口)

文章目录

​​code​​

code

使用matplotlib.pylot.pause(showTime) 即可完成显示和定时关闭操作: Run the GUI event loop for interval seconds.

If there is an active figure, it will be updated and displayed before the pause, and the GUI event loop (if any) will run during the pause.

This can be used for crude animation. For more complex animation use matplotlib.animation.

If there is no active figure, sleep for interval seconds instead.

import numpy as np import matplotlib.pyplot as plt mu,sigma=100,15 x=mu+sigma*np.random.randn(10000) n,bins,patches=plt.hist(x,50,density=1,facecolor='g',alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') """ 文字部分支持latex语法() DESCRIPTIONAdd text to the axes.Add text in string s to axis at location x, y, data coordinates.PARAMETERSx, y : scalarsdata coordinatess : stringtext"""plt.text(66,.0025, r'$\mu=100,\ \sigma=15$') """ Convenience method to get or set axis properties. """plt.axis([40,160,0,0.03]) plt.grid(True)# plt.show()# time.sleep(2)plt.pause(3)


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:九行代码带你爬取任何你想要爬取的图片
下一篇:呕心沥血解析用python画一个表白树(详解每一行代码),初学者也能看懂,授人以鱼不如授人以渔
相关文章

 发表评论

暂时没有评论,来抢沙发吧~