在seaborn热图中自动调整字体大小 [英] Auto adjust font size in seaborn heatmap

查看:393
本文介绍了在seaborn热图中自动调整字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用seaborn heatmap时,是否有一种方法可以自动调整字体大小以使其完全适合正方形内部?例如:

when using seaborn heatmap, is there a way to auto-adjust the font size for it to fit exactly inside the squares? for example in:

sns.heatmap(corrmat, vmin=corrmat.values.min(), vmax=1, square=True, cmap="YlGnBu", 
        linewidths=0.1, annot=True, annot_kws={"size":8})  

这里的大小设置在annot_kws"中.

here the size is set in "annot_kws".

推荐答案

您也可以这样做:

sns.heatmap(corrmat, vmin=corrmat.values.min(), vmax=1, square=True, cmap="YlGnBu", linewidths=0.1, annot=True, annot_kws={"fontsize":8})  

这篇关于在seaborn热图中自动调整字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆