I have the following code to show the color key above the heatmap. But the color key is not exact on top (a little shifted to the right) of the heatmap. Does anyone know how to make the color not shifted? Also, how to remove the white space on the right of the heatmap? Thanks.
library(gplots)
heatmap.2(
matrix(rnorm(100*10), nrow=100)
, dendrogram='none'
, Colv = F
, Rowv = F
, trace='none'
, col = colorRampPalette(c('blue', 'yellow'))(12)
, labRow=NA
, labCol=NA
, density.info='none'
, lmat=rbind(c(4, 2), c(1, 3)), lhei=c(2, 8), lwid=c(4, 1)
)
Best Answer
One can center the color key by adding "padding sections" ("5" and "6", in my particular case) to the lattice at the left (see the "#" comment over the last line of the code: