How to avoid scientific notation when annotating a seaborn clustermap?

前端 未结 1 1607
走了就别回头了
走了就别回头了 2021-01-25 08:33

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 w

1条回答
  •  有刺的猬
    2021-01-25 09:03

    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.

    0 讨论(0)
提交回复
热议问题