I'm looking to make a two, two range colour scheme heatmap where each range corresponds to a separate triangle in the heatmap square.
I am looking for a relevant guide for this heatmap. Any recommended package/library or guides? Thanks!
This solution doesn't reproduce the plot, but it would do if the numerical ranges between the triangles do not overlap.
import matplotlib.pyplot as plt
import seaborn as sns
xx = plt.get_cmap('rocket').copy()
xx.set_under('none')
yy = plt.get_cmap('mako').copy()
yy.set_over('none')
axis = sns.heatmap(dataframe, vmin=-1, cmap=xx, cbar_kws={'pad': -0.04})
sns.heatmap(dataframe, vmin=0, vmax=1, cmap=yy, ax=axis)
plt.show()
My colour schemes are not great but they are distinct, you can search for more here: https://seaborn.pydata.org/tutorial/color_palettes.html
The idea is this would address a situation where you compare the r-value OR a p-value against another set of values where are > 1. That's what the vmin
and vmax
are doing.
This is a ONE np array or dataframe solution. In other words you will need to combine your data sets. The solution you want is a two dataframes in one heatmap square. You can put two triangles side-by-side, i.e. one dataframe per heatmap, but I don't know who to place two separate dataframes in one heatmap.
*
,**
etc. as content to show p-value thresholds, and a color scale to show correlation value. $\endgroup$