matplotlib savefig() size control

前端 未结 5 753
执笔经年
执笔经年 2021-01-07 17:25

I wrote a function that took a dataframe generated from Pandas and produce a heatmap:

def drawHeatMap(df, city, province, collector, classtype, color, titlep         


        
5条回答
  •  误落风尘
    2021-01-07 18:16

    I added plt.tight_layout() before savefig(), and it solved the trimming issue I had. Maybe it will help yours as well.

    EDIT: I also set the figure size at the begining rcParams['figure.figsize'] = 40, 12(you can set your own width and height)

提交回复
热议问题