Skip to contents

Plots the phylogenetic tree and its associated tip and/or node data

Usage

plot_phylod(phylod, node_pies = FALSE)

Arguments

phylod

A phylo4d object from the package phylobase containing phylogenetic and endemicity data for each species.

node_pies

Boolean determining if pie charts of the probabilities of a species being present on the island. If TRUE the correct data is required in the phylod object.

Value

ggplot object

Examples

set.seed(
  1,
  kind = "Mersenne-Twister",
  normal.kind = "Inversion",
  sample.kind = "Rejection"
)
phylo <- ape::rcoal(10)
phylo$tip.label <- c("bird_a", "bird_b", "bird_c", "bird_d", "bird_e",
                     "bird_f", "bird_g", "bird_h", "bird_i", "bird_j")
phylo <- phylobase::phylo4(phylo)
endemicity_status <- sample(
  c("not_present", "endemic", "nonendemic"),
  size = length(phylobase::tipLabels(phylo)),
  replace = TRUE,
  prob = c(0.6, 0.2, 0.2)
)
phylod <- phylobase::phylo4d(phylo, as.data.frame(endemicity_status))
plot_phylod(phylod)