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

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

    I had this exact problem and this worked:

    plt.savefig(output_dir + '/xyz.png', bbox_inches='tight')
    

    Here is the documentation:

    [https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.savefig.html][1]

提交回复
热议问题