如何使用Python最大化plt.show()窗口 [英] How to maximize a plt.show() window using Python

查看:572
本文介绍了如何使用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的答案.

for Qt4Agg backend, see kwerenda's answer.

这篇关于如何使用Python最大化plt.show()窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆