matplotlib savefig() size control

前端 未结 5 700
执笔经年
执笔经年 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:23

    Short:
    You just need to call pl.figure(figsize=...) before you call the pl.colorbar (and all the other stuff)

    Explanation:
    pl.figure creates a new figure (with given size), on which all pl.* methods will act in the following.
    So pl.savefig just saves the last created figure, which is empty if you created a new one in the preceeding line.

提交回复
热议问题