Seaborn在热图中显示3位数字的科学计数法 [英] Seaborn showing scientific notation in heatmap for 3-digit numbers

查看:685
本文介绍了Seaborn在热图中显示3位数字的科学计数法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从pandasivot_table创建一个热图,如下所示:

I'm creating a heatmap from a pandas pivot_table as below:

table2 = pd.pivot_table(df,values='control',columns='Year',index='Region',aggfunc=np.sum)
sns.heatmap(table2,annot=True,cmap='Blues')

它将创建一个热图,如下所示.您可以看到数字不是很大(最大为750),但是以科学计数法显示了它们.如果我查看表格本身,则不是这种情况.关于如何使它以简单的符号显示数字有任何想法吗?

It creates a heat map as shown below. You can see the numbers are not huge (max 750), but it's showing them in scientific notation. If I view the table itself this is not the case. Any idea on how I could get it to show the numbers in plain notation?

推荐答案

根据

According to the docs, the param fmt=.2g is being applied because you've set annot=True so you can modify the format being applied to:

sns.heatmap(table2,annot=True,cmap='Blues', fmt='g')

这篇关于Seaborn在热图中显示3位数字的科学计数法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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