如何使用 Python 最大化 plt.show() 窗口 [英] How to maximize a plt.show() window using Python
本文介绍了如何使用 Python 最大化 plt.show() 窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于好奇,我想知道如何在下面的代码中执行此操作.我一直在寻找答案,但没有用.
Just for curiosity I would like to know how to do this in the code below. I have been searching for an answer but is useless.
import numpy as np
import matplotlib.pyplot as plt
data=np.random.exponential(scale=180, size=10000)
print ('el valor medio de la distribucion exponencial es: ')
print np.average(data)
plt.hist(data,bins=len(data)**0.5,normed=True, cumulative=True, facecolor='red', label='datos tamano paqutes acumulativa', alpha=0.5)
plt.legend()
plt.xlabel('algo')
plt.ylabel('algo')
plt.grid()
plt.show()
推荐答案
我通常使用
mng = plt.get_current_fig_manager()
mng.frame.Maximize(True)
在调用 plt.show()
之前,我得到了一个最大化的窗口.这仅适用于wx"后端.
before the call to plt.show()
, and I get a maximized window. This works for the 'wx' backend only.
对于 Qt4Agg 后端,请参阅 kwerenda 的answer.
for Qt4Agg backend, see kwerenda's answer.
这篇关于如何使用 Python 最大化 plt.show() 窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文