How not to use Scientific Notation in Seaborn’s heatmap

Understanding sns.heatmap()

We use heatmap for many tasks like correlation matrix, confusion matrix, similarity matrix, distance matrix, etc.

Let’s see an example of plotting a heatmap of the confusion matrix…

source: Created by author

You can see in the above picture that heatmap is not printing the actual number but instead in scientific notation.

See the below img to understand it better.

source: Created by author

you can see that by default format of fmt is '.2g' . So, just make it 'g' . then everything is ok.

Result:

source: Created by author.

If you have any problem which Google can’t solve. give me an opportunity at

@mdiqbalbajmi00786@gmail.com.

Thanks.

--

--

Muhammad Iqbal bazmi

A self-taught programmer, Data Scientist and Machine Learning Engineer