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()
To show matplotlib graphs as full screen, we can use full_screen_toggle() method.
For all backends, the window size is controlled by the figsize argument. In general, for any matplotlib figure object, you can also call fig. set_size_inches((width, height)) to change the size of the figure.
I am on a Windows (WIN7), running Python 2.7.5 & Matplotlib 1.3.1.
I was able to maximize Figure windows for TkAgg, QT4Agg, and wxAgg using the following lines:
from matplotlib import pyplot as plt ### for 'TkAgg' backend plt.figure(1) plt.switch_backend('TkAgg') #TkAgg (instead Qt4Agg) print '#1 Backend:',plt.get_backend() plt.plot([1,2,6,4]) mng = plt.get_current_fig_manager() ### works on Ubuntu??? >> did NOT working on windows # mng.resize(*mng.window.maxsize()) mng.window.state('zoomed') #works fine on Windows! plt.show() #close the figure to run the next section ### for 'wxAgg' backend plt.figure(2) plt.switch_backend('wxAgg') print '#2 Backend:',plt.get_backend() plt.plot([1,2,6,4]) mng = plt.get_current_fig_manager() mng.frame.Maximize(True) plt.show() #close the figure to run the next section ### for 'Qt4Agg' backend plt.figure(3) plt.switch_backend('QT4Agg') #default on my system print '#3 Backend:',plt.get_backend() plt.plot([1,2,6,4]) figManager = plt.get_current_fig_manager() figManager.window.showMaximized() plt.show()
if you want to maximize multiple figures you can use
for fig in figs: mng = fig.canvas.manager # ...
Hope this summary of the previous answers (and some additions) combined in a working example (at least for windows) helps. Cheers
With Qt backend (FigureManagerQT) proper command is:
figManager = plt.get_current_fig_manager() figManager.window.showMaximized()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With