Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save the COMPLETE figure with python-seaborn?

I have produced a heatmap with seaborn, and it looks like as following in ipython notebook: enter image description here

But when I tried to save it by the following way:

fig = plt.get_figure()
fig.savefig('heatmap.png')

Just part of the figure is saved and some of the labels of y-axis are lost: enter image description here

Could you please tell me how to save the whole figure? Thanks in advance!

like image 800
southdoor Avatar asked Feb 06 '23 07:02

southdoor


1 Answers

Try fig.savefig('heartmap.png',bbox_inches='tight')

like image 79
Serenity Avatar answered Feb 07 '23 22:02

Serenity