heatmap.2 颜色真的很奇怪
heatmap.2 colors really wonky
有谁知道为什么我的 heatmap.2 结果有奇怪的颜色 - 绿松石不属于我的 red/black/green 调色板?看起来绿松石指的是基于样本聚类的信息(我 "FALSE"-ed 出的行树状图),而不是基于特征聚类的信息。这是怎么回事?
我正在使用 gplots、RBrewerColor 和 heatmap.2() 方法。
代码:
temp <- t(iris[,1:4])
sampleLabels.c <- as.character(iris[,5])
sampleLabels.c[sampleLabels.c=="setosa"] <- "red"
sampleLabels.c[sampleLabels.c=="versicolor"] <- "orange"
sampleLabels.c[sampleLabels.c=="virginica"] <- "green"
# Sort on max difference
t.min <-apply(temp, 1, min)
t.max <- apply(temp, 1, max)
temp <- temp[order(t.max-t.min, decreasing=TRUE),]
# cluster on correlation
hc <- hclust(as.dist(1 - cor(temp)), method="average")
png("iris.png", 1000, 1000)
par(mar=c(1,1,1,1))
heatmap.2(as.matrix(temp),
Rowv=FALSE,
Colv=as.dendrogram(hc),
dendrogram="column",
col=greenred(10),
labRow="", labCol="", key=TRUE,
ColSideColors=sampleLabels.c)
legend("left",
legend=c("Setosa", "Versicolor", "Virginica"),
col=c("red", "orange", "green"),
lty=1, lwd=2)
dev.off()
这是从代码(上面)生成的图像。
感谢您的任何见解!
在 ?heatmap.2
中搜索 "cyan" 得到:
trace=c("column","row","both","none"),
tracecol="cyan" ...
...
trace
: character string indicating whether a solid "trace" line
should be drawn across 'row's or down 'column's, 'both' or
'none'. The distance of the line from the center of each
color-cell is proportional to the size of the measurement.
Defaults to 'column'.
尝试设置 trace="none"
... ?
有谁知道为什么我的 heatmap.2 结果有奇怪的颜色 - 绿松石不属于我的 red/black/green 调色板?看起来绿松石指的是基于样本聚类的信息(我 "FALSE"-ed 出的行树状图),而不是基于特征聚类的信息。这是怎么回事?
我正在使用 gplots、RBrewerColor 和 heatmap.2() 方法。
代码:
temp <- t(iris[,1:4])
sampleLabels.c <- as.character(iris[,5])
sampleLabels.c[sampleLabels.c=="setosa"] <- "red"
sampleLabels.c[sampleLabels.c=="versicolor"] <- "orange"
sampleLabels.c[sampleLabels.c=="virginica"] <- "green"
# Sort on max difference
t.min <-apply(temp, 1, min)
t.max <- apply(temp, 1, max)
temp <- temp[order(t.max-t.min, decreasing=TRUE),]
# cluster on correlation
hc <- hclust(as.dist(1 - cor(temp)), method="average")
png("iris.png", 1000, 1000)
par(mar=c(1,1,1,1))
heatmap.2(as.matrix(temp),
Rowv=FALSE,
Colv=as.dendrogram(hc),
dendrogram="column",
col=greenred(10),
labRow="", labCol="", key=TRUE,
ColSideColors=sampleLabels.c)
legend("left",
legend=c("Setosa", "Versicolor", "Virginica"),
col=c("red", "orange", "green"),
lty=1, lwd=2)
dev.off()
这是从代码(上面)生成的图像。
在 ?heatmap.2
中搜索 "cyan" 得到:
trace=c("column","row","both","none"), tracecol="cyan" ... ...
trace
: character string indicating whether a solid "trace" line should be drawn across 'row's or down 'column's, 'both' or 'none'. The distance of the line from the center of each color-cell is proportional to the size of the measurement. Defaults to 'column'.
尝试设置 trace="none"
... ?