Seaborn heatmap reducing cell size

Viewed 20099

Is there any way to change cell size of Seaborn heatmap? I found this but I cannot get it work as expected.

So, I have long text in y-axis labels. Since all of the texts are chopped off, I would like to shrink cell size of the heatmap much smaller. I don't need that big rectangle. (Highlighted just for example.)

enter image description here (I hid label names.)

When I change the figure size by something like,

plt.figure(figsize=(8, 6)) or 
figure.set_size_inches(12, 12) 

the cell gets bigger as well so the texts remain chopped off.

Here is the code.

sns.set(font_scale=1.2)
ax0 = plt.axes()
ax1 = sns.heatmap(hmap, cbar=0, cmap="YlGnBu",linewidths=2, ax=ax0,vmax=3000, vmin=0)
ax1.set_title('test heatmap')

for item in ax1.get_yticklabels():
    item.set_rotation(0)

for item in ax1.get_xticklabels():
    item.set_rotation(0)

figure = plt.gcf()  # get current figure
figure.set_size_inches(12, 12)
plt.savefig('test.png') , dpi=400)
2 Answers
Related