Entering edit mode
Tim Smith
★
1.1k
@tim-smith-1532
Last seen 10.3 years ago
Hi,
I was trying to generate a heatmap with three colors (I have three
values i.e, -1,0,1). I was using the following code (suggested
earlier):
-----------------------------------------------
r1 <- matrix(0:1,11,5)
r2 <- matrix(-1:0,13,5)
matr <- rbind(r1,r2)
rownames(matr) <- LETTERS[1:nrow(matr)]
colnames(matr) <- 1:5
heatmap(matr,col=c('green','black','red'))
---------------------------------------------
What
I want is for the -1 values to be green cells, 0 values to be black
cells & 1 values to be red cells. However, I only seem to get red
and green colors in the cell. What do I need to do to get this right?
thanks!
[[alternative HTML version deleted]]