0

I've read dozens of pages/posts on how to prevent seaborn heatmap from showing scientific notation but they are all about avoiding it in the annotations. I've tried to implement that but no matter what I try the heatmap wants to give me scientific notation. The count I'm trying to display is in the millions which maybe is why it wants to display in scientific notation but that is not what I want. Any suggestions?enter image description here

boondocks5
  • 31
  • 1
  • 7
  • 2
    You can change the colorbar tick formatting via `sns.heatmap(..., cbar_kws={'format': '%.0f'})`. When posting on StackOverflow, please add minimal reproducible code and data in text format, not as an image. – JohanC Mar 28 '23 at 05:43
  • this is indeed the solution, thank you SO MUCH!! – boondocks5 Mar 28 '23 at 13:08
  • any chance you know how to add commas into larger numbers? – boondocks5 Mar 28 '23 at 13:08
  • I've followed the documentation all the way to this dead end but it doesn't explain the format options at all. https://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.ScalarFormatter – boondocks5 Mar 28 '23 at 13:33
  • 2
    Matplotlib uses of few different ways for the formatting, which is indeed confusing. Here `cbar_kws={'format': lambda x, pos:f'{x:,.0f}'}` seems to work. – JohanC Mar 28 '23 at 13:46

0 Answers0