Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to maximize plt.show() using python on mac?

I'm trying to maximize pt.show() on Mac. I'm using Python.

mac OS X ==10.10.3, python==3.4.2 matplotlib==1.4.3

I have already tried the following:

mng.frame.Maximize(True)

mng.window.showMaximized()

mng.resize(*mng.window.maxsize())

mng.full_screen_toggle()

mng.window.state('zoomed')


from scipy import misc
import matplotlib.pyplot as plt

image = misc.lena()
plt.imshow(image)
mng = plt.get_current_fig_manager()
mng.frame.Maximize(True)
plt.show()
like image 691
Zingo Avatar asked May 23 '15 01:05

Zingo


People also ask

How do you make the PLT bigger in Python?

pyplot library. To change the figure size, use figsize argument and set the width and the height of the plot. Next, we define the data coordinates. To plot a bar chart, use the bar() function.

How do I make matplotlib full screen?

To show matplotlib graphs as full screen, we can use full_screen_toggle() method.

How do you show PLT in Python?

Plotting from a script If you are using Matplotlib from within a script, the function plt. show() is your friend. plt. show() starts an event loop, looks for all currently active figure objects, and opens one or more interactive windows that display your figure or figures.


1 Answers

I had the same issue and I simply used a different back-end than MacOSX one.

Try:

plt.switch_backend('Qt4Agg')

figM = plt.get_current_fig_manager()
figM.window.showMaximized()

You can also switch your backend in the default matplotlibrc file, but I prefer the above method for a quick workaround, as I use the MacOSX regularly.

like image 163
TheDragonReborn Avatar answered Sep 18 '22 13:09

TheDragonReborn