Black007的个人博客分享 http://blog.sciencenet.cn/u/Black007

博文

[转载]聚类分析树之间的对比

已有 3450 次阅读 2019-9-13 11:49 |个人分类:数据分析|系统分类:科研笔记|文章来源:转载

昨天跑着《Numerical Ecology with R》(2018版)的代码,又出了一张很有意思的图。
Rplot01.png

这个图是用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"
)


https://blog.sciencenet.cn/blog-3412381-1197807.html

上一篇:[转载]用 googleVis 包画地图
下一篇:[起飞] Typora+Picgo 自动云端上传markdown中的图片并生成链接
收藏 IP: 210.72.88.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-17 02:44

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部