pythonmatplotlib

How to maximize a plt.show() window


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()

Solution

  • I usually use

    mng = plt.get_current_fig_manager()
    mng.frame.Maximize(True)
    

    before the call to plt.show(), and I get a maximized window. This works for the 'wx' backend only.

    EDIT:

    for Qt4Agg backend, see kwerenda's answer.