繁体   English   中英

heatmap.2颜色真的很不稳定

[英]heatmap.2 colors really wonky

有谁知道为什么我的heatmap.2结果有奇怪的颜色 - 绿松石不属于我的红色/黑色/绿色调色板? 绿松石似乎是指基于样本聚类的信息(行“树状图”,我“假”出来),而不是基于特征聚类。 怎么了?

我正在使用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搜索“青色”给出:

trace = c(“column”,“row”,“both”,“none”),tracecol =“cyan”......

trace :字符串,指示是否应在“行”或“向下”列,“两者”或“无”之间绘制实线“跟踪”行。 线与每个色单元中心的距离与测量的大小成比例。 默认为“列”。

尝试设置trace="none" ......?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM