Skip to content Skip to sidebar Skip to footer

How To Avoid Scientific Notation When Annotating A Seaborn Clustermap?

I have a dataframe that contains percentages. If I use seaborn to make a clusterplot somehow the number 100 is plotted as 1+e01. Is there any way to avoid this? I tried rounding th

Solution 1:

Use fmt="d", as in this example:

import seaborn as sns
sns.set()

flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
flights = flights.reindex(flights_long.iloc[:12].month)

sns.heatmap(flights, annot=True, fmt="d")

enter image description here

fmt is a parameter to heatmap but additional clustermap kwargs are passed through to the main heatmap.

Post a Comment for "How To Avoid Scientific Notation When Annotating A Seaborn Clustermap?"