Plt.show shows full graph but savefig is cropping the image

后端 未结 1 664
南旧
南旧 2021-01-30 07:57

My code is succesfully saving images to file, but it is cropping important details from the right hand side. Answers exist for fixing this problem when it arises for plt.s

相关标签:
1条回答
  • 2021-01-30 08:29

    You may try

    plt.savefig('X:/' + newName + '.png', bbox_inches='tight')
    

    Or you may define figure size like

    fig = plt.figure(figsize=(9, 11))
    ...
    plt.savefig(filename, bbox_inches = 'tight')
    
    0 讨论(0)
提交回复
热议问题