新浪博客

R语言画树状聚类图

2018-08-27 20:20阅读:
gene<-read.table('1.txt',header=T,sep='')
hc = hclust(dist(gene))
hcd = as.dendrogram(hc)
plot(hcd)
colLab <- function(n) {
if (is.leaf(n)) {
a <- attributes(n)
labCol <- labelColors[clusMember[which(names(clusMember) == a$label)]]
attr(n, 'nodePar') <- c(a$nodePar, lab.col = labCol)
}
n
}
clusDendro = dendrapply(hcd, colLab)
plot(clusDendro, main = 'Cool Dendrogram', type = 'rectangle')

我的更多文章

下载客户端阅读体验更佳

APP专享