How to make pylab.savefig() save image for 'maximized' window instead of default size

前端 未结 8 2245
一整个雨季
一整个雨季 2020-12-12 17:49

I am using pylab in matplotlib to create a plot and save the plot to an image file. However, when I save the image using pylab.savefig( image_name ), I find tha

8条回答
  •  半阙折子戏
    2020-12-12 18:37

    Check this: How to maximize a plt.show() window using Python

    The command is different depending on which backend you use. I find that this is the best way to make sure the saved pictures have the same scaling as what I view on my screen.

    Since I use Canopy with the QT backend:

    pylab.get_current_fig_manager().window.showMaximized()
    

    I then call savefig() as required with an increased DPI per silvado's answer.

提交回复
热议问题