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

前端 未结 8 2246
一整个雨季
一整个雨季 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:45

    I think you need to specify a different resolution when saving the figure to a file:

    fig = matplotlib.pyplot.figure()
    # generate your plot
    fig.savefig("myfig.png",dpi=600)
    

    Specifying a large dpi value should have a similar effect as maximizing the GUI window.

提交回复
热议问题