Remove padding from matplotlib plotting

后端 未结 4 935
心在旅途
心在旅途 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:49

    Try using pad_inches=0, i.e.

    plt.savefig( IMG_DIR + 'match.png',bbox_inches='tight', transparent="True", pad_inches=0)
    

    From the documentation:

    pad_inches: Amount of padding around the figure when bbox_inches is ‘tight’.

    I think the default is pad_inches=0.1

提交回复
热议问题