|||
昨天跑着《Numerical Ecology with R》(2018版)的代码,又出了一张很有意思的图。
这个图是用tanglegram{dendextend}画的,具体代码如下。
# Objects of class "hclust" must be first converted into objects of
# class "dendrogram"
class(spe.ch.ward)
dend1 <- as.dendrogram(spe.ch.ward)
class(dend1)
dend2 <- as.dendrogram(spe.ch.complete)
dend12 <- dendlist(dend1, dend2)
dev.new(
title = "Compare two dendrograms",
width = 12,
height = 8,
noRStudioGD = TRUE
)
tanglegram(
untangle(dend12),
sort = FALSE,
common_subtrees_color_branches = TRUE,
main_left = "Ward method",
main_right = "Complete linkage"
)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-29 13:57
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社