How to plot dendrograms with large datasets?

后端 未结 2 1330
渐次进展
渐次进展 2021-01-30 11:45

I am using ape (Analysis of Phylogenetics and Evolution) package in R that has dendrogram drawing functionality. I use following commands to read the data in Newick format, and

2条回答
  •  忘了有多久
    2021-01-30 11:53

    It is possible to cut a dendrogram at a specified height and plot the elements:

    First create a clustering using the built-in dataset USArrests. Then convert to a dendrogram:

    hc <- hclust(dist(USArrests))
    hcd <- as.dendrogram(hc)
    

    Next, use cut.dendrogram to cut at a specified height, in this case h=75. This produces a list of a dendrogram for the upper bit of the cut, and a list of dendograms, one for each branch below the cut:

    par(mfrow=c(3,1))
    
    plot(hcd, main="Main")
    plot(cut(hcd, h=75)$upper, 
         main="Upper tree of cut at h=75")
    plot(cut(hcd, h=75)$lower[[2]], 
         main="Second branch of lower tree with cut at h=75")
    

    enter image description here

提交回复
热议问题