Entering edit mode
Yen Ngo
▴
20
@yen-ngo-3322
Last seen 10.2 years ago
Dear list,
Using example from heatmap_2 (Heatplus) i could conduct a heatmap.
However when i changed the color key according to
a certain range, the labels on the color key didnt change. Is there a
way to fix this?
Thanks in advance.
Yen
mm = matrix(rnorm(1000, m=1), 100,10)
mm = cbind(mm, matrix(rnorm(2000), 100, 20))
mm = cbind(mm, matrix(rnorm(1500, m=-1), 100, 15))
mm2 = matrix(rnorm(450), 30, 15)
mm2 = cbind(mm2, matrix(rnorm(900,m=1.5), 30,30))
mm=rbind(mm, mm2)
colnames(mm) = paste("Sample", 1:45)
rownames(mm) = paste("Gene", 1:130)
> max(apply(mm,1,max))
[1] 4.452612
windows()
heat.col <- c("#FF0000FF", "#FF2400FF", "#FF4900FF", "#FF6D00FF"
,"#FF9200FF",
"#FFB600FF", "#FFDB00FF", "#FFFF00FF",
"#FFFF40FF", "#FFFFAAFF")
heatmap_2(mm, Rowv = NA, Colv = NA, scale="none",
legend=1,col=heat.col[length(heat.col):1])
## Change the color key to 0-7
## would like color key on the legend to indicate 0-7 not from 0 to
the
original max value.
windows()
heat.col <- c("#FF0000FF", "#FF2400FF", "#FF4900FF", "#FF6D00FF"
,"#FF9200FF",
"#FFB600FF", "#FFDB00FF", "#FFFF00FF",
"#FFFF40FF", "#FFFFAAFF")
breaks <-seq(0, 7, length.out=11)
heatmap_2(mm, Rowv = NA, Colv = NA,
scale="none",breaks=breaks,
legend=1,col=heat.col[length(heat.col):1])
[[alternative HTML version deleted]]