I am trying to make a heatmap in R where my data ranges from -5 to +50. I would like values of 0 to be white, the values between 0 and -5 to be coloured on a gradient from white to blue and the values between 0 and +50 to be coloured from white to red. Ideally, I'd also like the same scaling to be used, i.e. the darkness of blue at -5 to be the same as the darkness of the red at +5.
I have working code for heatmap with the gradient for the whole data set from blue to red with white colouring points close to the mean of the data.
hv <- heatmap.2(data_matrix,
scale="none",
Rowv=NA,
Colv=NA,
col = rev(brewer.pal(11,"RdBu")),
margins=c(5,5),
cexRow=0.5, cexCol=1.0,
ylab= "Mutations",
main = "heatmap",
key=TRUE,keysize=1.5, trace="none")
Any suggestions would be greatly appreciated.
Cheers!