我有多个类似于以下的热图:
X <- matrix(nrow=3, ncol=3)
X[1,] <- c(0.3, 0.4, 0.45)
X[2,] <- c(0.3, 0.7, 0.65)
X[3,] <- c(0.3, 0.4, 0.45)
colnames(X)<-c(1.5, 3, 4)
rownames(X)<-c(1.5, 3, 4)
library(gplots)
heatmap.2( X, Rowv=NA, Colv=NA, col=rev(heat.colors(256)),
sepcolor="black", trace="none",dendrogram="none" )
现在,为了使这种多张图看起来更相似,我怎样才能让左上角的直方图总是介于 0 和 1 之间?
根据 yuk 的回答,我制作了这个版本:
X <- matrix(nrow=3, ncol=3)
X[1,] <- c(0.3, 0.4, 0.45)
X[2,] <- c(0.3, 0.7, 0.65)
X[3,] <- c(0.3, 0.4, 0.45)
colnames(X)<-c(1.5, 3, 4)
rownames(X)<-c(1.5, 3, 4)
library(gplots)
colors <- rev(heat.colors(256))
colbr <- c(seq(0, 1, len=length(colors)+1))
heatmap.2(X, scale="none", col=colors, breaks=colbr,
key=T, symkey=F, density.info="histogram", trace="none", Rowv=NA, Colv=NA,
sepcolor="black", dendrogram="none" )
现在色阶在 0 和 1 位之间,直方图仍然没有。