So my table looks kinda like this:
Cl1 Cl2 Cl3 Sum
0.7 0.9 0.9 2.5
0.8 1.5 0.9 3.2
2.4 2.8 2.1 7.3
I want the heatmap color apply to columns 1-3, but not to Sum
, because it takes all the juice from the heatmap and makes the columns look bland.
All I came up with right now is dividing the Sum value by 100, but that will confuse readers and will require explanations.
Is there a way to not format the Sum column, but keep its values as is?
Some code to get going:
import numpy as np
import pandas as pd
import seaborn as sns
df = pd.DataFrame(np.random.rand(3,3), columns='Cl1 Cl2 Cl3'.split())
df['Sum'] = 0
for i in df.index:
df['Sum'].iloc[i] = np.sum(df.iloc[i])
sns.heatmap(df, annot=True, cmap='Reds')