Plot two trees in one plot

plot_two_tree(
  tree1,
  tree2,
  edge_df = NULL,
  tree2_x = 10,
  filter_link = FALSE,
  tree1_param = list(),
  tree2_param = list(),
  line_param = list(),
  tree1_tip = FALSE,
  tip1_param = list(),
  tree2_tip = FALSE,
  tip2_param = list(),
  tree1_highlight = NULL,
  highlight1_param = list(),
  highlight1_scale = NULL,
  tree2_highlight = NULL,
  highlight2_param = list(),
  highlight2_scale = ggplot2::scale_fill_hue(na.value = NA)
)

Arguments

tree1

phylo object

tree2

phylo object

edge_df

dataframe with edge information, containing "from" and "to" columns

tree2_x

x position of tree2

filter the link between tree1 and tree2

tree1_param

parameters for geom_tree

tree2_param

parameters for geom_tree

line_param

parameters for geom_line

tree1_tip

tree tip label

tip1_param

parameters for geom_tiplab

tree2_tip

tree tip label

tip2_param

parameters for geom_tiplab

tree1_highlight

tree1 highlight data.frame

highlight1_param

parameters for geom_hilight

highlight1_scale

scale_fill_ for highlight1

tree2_highlight

tree2 highlight data.frame

highlight2_param

parameters for geom_hilight

highlight2_scale

scale_fill_ for highlight2

Value

ggplot object

Examples

if (requireNamespace("ggtree")) {
  data(otutab, package = "pcutils")
  df2tree(taxonomy[1:50, ]) -> tax_tree
  df2tree(taxonomy[51:100, ]) -> tax_tree2
  link <- data.frame(from = sample(tax_tree$tip.label, 20), to = sample(tax_tree2$tip.label, 20))
  plot_two_tree(tax_tree, tax_tree2, link)
}
#> Loading required namespace: ggtree