python-3.x - Seaborn:如何增加轴上标签的字体大小?
问题描述
这是我绘制热图的方法:
sns.heatmap(table, annot=True, fmt='g', annot_kws={'size':24})
问题是,size
只设置热图中数字的字体大小。我应该使用哪个参数annot_kws
来设置轴上标签的字体大小?
谢谢
解决方案
您不能直接在调用中更改它们heatmap
,但您可以指示 matplotlib 直接更改字体大小,或plt.rcParams
使用上下文管理器:
uniform_data = np.random.rand(10, 12)
plt.figure()
with plt.style.context({'axes.labelsize':24,
'xtick.labelsize':8,
'ytick.labelsize':16}):
ax = sns.heatmap(uniform_data, annot=True, fmt='.1f', annot_kws={'size':6})
ax.set_xlabel('x label')
推荐阅读
- sql-server-express - 如何将密码添加到localdb
- angular - mat-form-field 上动态添加的提示标签仅在组件获得焦点后才可见
- uml - JHipster UML 和 JDL 的用例和区别
- .net - DotNet 命令行错误
- javascript - 页面重新加载后如何加载不同的 Javascript(广告)?
- vim - 选择相对范围,忽略无效的行号
- c++ - 循环问题
- django - 用户注册后 Django 执行自定义代码
- ruby-on-rails-5 - Rails form_with:local:true与remote:false相同吗?
- javascript - 无法使用 Selenium 单击按钮