Remove padding from matplotlib plotting

后端 未结 4 940
心在旅途
心在旅途 2021-02-07 13:24

I am plotting an image in matplotlib, and it keeps giving me some padding. This is what I have tried:

def field_plot():
    x = [i[0] for i in path]
    y = [i[1         


        
4条回答
  •  情深已故
    2021-02-07 13:40

    Just add plt.tight_layout() before plt.savefig() !!

    plt.figure(figsize=(16, 10))
    
    # ... Doing Something ...
    
    plt.tight_layout()
    plt.savefig('wethers.png')
    plt.show()
    

提交回复
热议问题