简体   繁体   English

热图中的值不可读

[英]Unreadable values in heatmap

I have a dataframe df containing numeric values 1432,22390,43223 and so on... 我有一个包含数值1432、22390、43223等的数据框df ,依此类推...
When I try to plot it using a heatmap like this 当我尝试使用像这样的热图绘制它时
sns.heatmap(df[cols].transpose(), annot=True)
I'm getting these unreadble values 2.2e+04, 1.7e+03 etc. The thing is that in another notebook I'm using the same code and it works perfectly. 我得到了这些无法读取的值2.2e + 04、1.7e + 03等。问题是,在另一个笔记本中,我使用的是相同的代码,它可以完美地工作。
So what is the problem? 那么问题是什么?

When you set annot=True , the default param fmt='.2g' is being applied (ie, it is going to round each number to 2 significant digits and then formats the result in either fixed-point format or in scientific notation, depending on its magnitude). 当你设置annot=True ,正在应用默认的param fmt='.2g' (即,它将每个数字四舍五入为2位有效数字,然后以定点格式或科学计数法格式化结果,具体取决于在它的大小)。 To have the general format, you simply change fmt='.2g' to fmt='g' . 要获得通用格式,只需将fmt='.2g'更改为fmt='g'

Here you can find more information about formats 在这里您可以找到有关格式的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM