我生成使用R.
熱圖我用hclust
功能,並得到了錯誤的大小: Colv dendrogram doesn't match size of x
。heatmap.2-錯誤:COLV樹狀圖不符X
下面是我的代碼,它與一個正方形矩陣完美配合。現在我的輸入矩陣是400x2000
。有人能告訴我爲什麼我得到這個錯誤嗎?
data <- read.table("mydata.txt",sep="\t",header=TRUE,row.names=1)
data_matrix <- data.matrix(data)
library(gplots)
library("RColorBrewer")
colors <- colorRampPalette(rev(brewer.pal(9, "Blues")))(255)
hc_dist= dist(data_matrix)
hc_clust= hclust(hc_dist)
hr_dist= dist(t(data_matrix))
hr_clust= hclust(hr_dist)
heatmap.2(data_matrix, col=brewer.pal(11,"RdBu"), labRow=NA, density.info="none", scale="row",trace="none",Colv=as.dendrogram(hc_clust), Rowv=as.dendrogram(hr_clust))
Error in heatmap.2(data_matrix, col = brewer.pal(11, "RdBu"), labRow = NA,:Colv dendrogram doesn't match size of x
嘗試'COLV =爲.dendrogram(hr_clust),rowv = as.dendrogram(hc_clust)'...(你給出colv中行分類的結果,反之亦然) – Cath 2015-02-06 13:33:39