YuLab-SMU / treeio

:seedling: Base Classes and Functions for Phylogenetic Tree Input and Output
https://yulab-smu.top/treedata-book/
94 stars 24 forks source link

supporting dendro class to phylo class #95

Closed xiangpin closed 1 year ago

xiangpin commented 1 year ago

Description

add as.phylo.dendro method to convert dendro class to phylo class

Related Issue

new feature

Example

library(ggplot2)
library(ggtree)
library(treeio)
library(ggdendro)

hc <- hclust(dist(USArrests), "ave")

x <- dendro_data(hc)

tr <- as.phylo(x)

p1 <- ggtree(hc, hang = -1) +
      theme_tree2() +
      scale_x_continuous(expand = c(0, 0.01)) +
      geom_tiplab(as_ylab = T)

p2 <- ggtree(tr) +
      theme_tree2() +
      scale_x_continuous(expand = c(0, 0.01)) +
      geom_tiplab(as_ylab = T)

f <- p1 / p2

捕获