I am trying to figure out how to get an Heatmap with two different colour keys: one for my values (which belong to the first and second columns of my matrix "df1") and a different one for my pvalue (determined by the difference between my first and second column). I have 50 different observations in total (50 rows and 3 columns). Does anyone get an idea on how to plot the pvalue column with a different colour map?
This is how my code looks like:
df1<-as.matrix(df)
yb<-colorRampPalette(c("lightcyan","darkblue", "red"))
heatmap.2(df1,
trace=NULL,
margins = c(2,20),
colsep = c(1,2,3),
col=yb,
tracecol = NULL,
key.title = NA,
cexCol = 1,
srtCol = 0,
adjCol = 1,
sepcolor="black",
sepwidth=c(0.0001,0.001),
rowsep=1:nrow(df1),
Colv = FALSE,
keysize = 1,
key.xlab = "Normalized plaques count",
key.ylab = NA)
I'm not sure this is the intended use of heatmap2
- it seems you really need two different plots. The values in one plot and the p-values in another. You would need to customise code I think to plot those together (which would not strictly be correct anyway) and I suspect this would be more trouble than it is worth. Some stuff is easier in a graphics editor unless you are intending to produce very many of these.