Learn R Programming

delimtools (version 0.2.0)

delim_autoplot: Plot Phylogenetic Trees With Species Delimitation Partitions

Description

delim_autoplot() returns a phylogenetic tree plotted using ggtree alongside with a customized tile plot using geom_tile combined by wrap_plots.

Usage

delim_autoplot(
  delim,
  tr,
  consensus = TRUE,
  n_match = NULL,
  delim_order = NULL,
  tbl_labs = NULL,
  col_vec = NULL,
  hexpand = 0.1,
  widths = c(0.5, 0.2)
)

Value

A patchwork object.

Arguments

delim

Output from delim_join.

tr

A treedata object. Both phylogram and ultrametric trees are supported.

consensus

Logical. Should the majority-vote consensus to be estimated?

n_match

An Integer. If consensus = TRUE, threshold for majority-vote calculations. See delim_consensus for details.

delim_order

A character vector of species delimitation names ordered by user. Default to NULL.

tbl_labs

A tbl_df of customized labels for tree plotting. The first column must match tip labels of the tr object, while the second column should have customized labels.

col_vec

A color vector for species delimitation partitions. See delim_brewer for customized color palette options.

hexpand

Numeric. Expand xlim of tree by a ratio of x axis range. Useful if tiplabels become truncated when plotting. Default to 0.1.

widths

A numeric vector containing the relative widths of the tree and species delimitation bars. See wrap_plots for details. Defaults to c(0.5, 0.2).

Author

Pedro S. Bittencourt, Rupert A. Collins.

Details

delim_autoplot() is a wrapper for tree plotting with associated data implemented using ggtree, ggplot2, and patchwork. If consensus = TRUE, a consensus bar will be plotted next to the species delimitation plot, summarizing partitions across samples. If no consensus is reached, an "X" will be plotted instead.

Examples

Run this code
# view partitions using an ultrametric tree
p <- delim_autoplot(geophagus_delims, geophagus_beast)
p

# view partitions using a phylogram
p1 <- delim_autoplot(geophagus_delims, geophagus_raxml)

Run the code above in your browser using DataLab