我正在尝试dendrogram
使用大量节点绘制 aggdendrogram
并且它非常慢(与dendextend
例如相比):
set.seed(1)
mat <- matrix(rnorm(100*10),nrow=100,ncol=10)
dend <- as.dendrogram(hclust(dist(mat)))
require(ggdendro)
require(dendextend)
require(microbenchmark)
> microbenchmark(ggdendrogram(dend,rotate=T,labels=F,size=4,theme_dendro=F))
Unit: milliseconds
expr min lq mean median uq max neval
ggdendrogram(dend, rotate = T, labels = F, size = 4, theme_dendro = F) 394.3181 409.3591 431.0981 412.515 416.4568 1346.844 100
> microbenchmark(dend %>% plot(horiz = TRUE))
Unit: milliseconds
expr min lq mean median uq max neval
dend %>% plot(horiz = TRUE) 138.7253 207.92 214.5278 208.8807 211.2602 640.0316 100
有什么办法可以加快速度使其与dendextend
' 情节的速度相媲美?
另外,无论我指定rotate=T
还是
ggdendrogram(dend,rotate=F,labels=F,size=4,theme_dendro=F)+coord_flip()
但我希望它指向正确。知道如何让它工作吗?