【问题标题】:How to draw dendrogram using ape package in R?如何在 R 中使用 ape 包绘制树状图?
【发布时间】:2017-09-07 11:56:40
【问题描述】:

我有一个 ~200 x 200 大小的距离矩阵,我无法使用 R 中猿库的 BioNJ 选项绘制树状图 尺寸很大以使情节可见 有什么方法可以提高知名度

【问题讨论】:

    标签: r dendrogram ape-phylo


    【解决方案1】:

    两个选项,取决于您的数据

    如果您需要计算数据的距离矩阵,请使用

    set.seed(1)                          # makes random sampling with rnorm reproducible
    # example matrix
    m <- matrix(rnorm(100), nrow = 5)    # any MxN matrix
    distm <- dist(m)                     # distance matrix
    hm <- hclust(distm)
    plot(hm)
    

    如果你的数据是距离矩阵(必须是方阵!)

    set.seed(1)
    # example matrix
    m <- matrix(rnorm(25), nrow=5)       # must be square matrix!
    distm <- as.dist(m)
    hm <- hclust(distm)
    plot(hm)
    

    一个 200 x 200 的距离矩阵给了我一个合理的情节

    set.seed(1)
    # example matrix
    m <- matrix(rnorm(200*200), nrow=200)       # must be square matrix!
    distm <- as.dist(m)
    hm <- hclust(distm)
    plot(hm)
    

    【讨论】:

    • 虽然使用聚类,但该图看起来像一个棒状质量,我无法从中识别出任何模式,我的方阵大小为 200 X 200
    • 你可以尝试在底部绘制 200x200 距离矩阵。你得到了什么?
    • @LakshmiKrishnaKumaar 你试过我答案底部的情节吗?
    • 感谢您的回答,但尝试绘图也给出了类似的绘图,我正在用数据检查一次
    猜你喜欢
    • 2013-09-22
    • 1970-01-01
    • 1970-01-01
    • 2020-10-17
    • 2015-09-22
    • 2015-05-21
    • 1970-01-01
    • 1970-01-01
    • 2015-03-17
    相关资源
    最近更新 更多