如何在mac上使用python最大化plt.show()?

Zin*_*ngo 10 python macos matplotlib python-3.x

我正在尝试在Mac上最大化pt.show().我正在使用Python.

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

我已经尝试过以下方法:

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()
Run Code Online (Sandbox Code Playgroud)

小智 3

我遇到了同样的问题,只是使用了与 MacOSX 不同的后端。

尝试:

plt.switch_backend('Qt4Agg')

figM = plt.get_current_fig_manager()
figM.window.showMaximized()
Run Code Online (Sandbox Code Playgroud)

您还可以在默认的matplotlibrc文件中切换后端,但我更喜欢使用上述方法来快速解决问题,因为我经常使用 MacOSX。