I need to show the values in a dataframe column as a binary colormap, based on whether they are above or below a threshold. I also need to show the raw numbers.
I am using seaborn heatmap.
sample data frame
Month Raw_value
Jan 3.72
feb 2.51
Mar 1.82
...
I have converted the column to binary, then retained only the index & binary column & removed other columns from dataframe, then plotted as binary. But this won't help to show the actual numbers (see figure).
kpi2['status'] = np.where(kpi2['raw_value'] > thres, 1,0) # convert to binary
kpi2 = kpi2.set_index('month')
kpi2.drop(['raw_value'], axis=1, inplace=True) # drop other columns
kpi_transposed = kpi2.transpose() # convert column to row for plotting horizontally
rdgn = sns.diverging_palette(h_neg=130, h_pos=10, s=99, l=55, sep=3, as_cmap=True)
sns.heatmap(kpi_transposed, linecolor='white', linewidths=1.3,vmin=0, vmax=1, cmap=rdgn, cbar=False)
plt.show()
But if I work with the raw data column, I am unsure how to color it as binary.
Any idea?

