I have a heat map that gets its labels automatically, however some of them are long decimals (I don't understand why because the values I used for the heatmap have 3 decimals, for example 0.009 appears as a long decimal), I would like to round all labels to 4 decimals places. Here is the relevant part of the code:
table1 = df.pivot('ToxinK','Khill','Fraction') #Putting information from the dataframe into a pivot table
sns.heatmap(table1,cmap='Purples',norm=LogNorm())
I have tried a solution that I found on seaborn too long numeric labels, however is not working for me, I don't know why Here is the attempt:
majorFormatter = FormatStrFormatter('%0.4f')
ax1=sns.heatmap(table1,cmap='Purples',norm=LogNorm())
ax1.yaxis.set_major_formatter(majorFormatter)
Any advice or piece of information on how to solve this problem would be incredibly useful. Thanks in advance!

