machu.treeplot: Plot trees to visualize each step in the Machuruku process

View source: R/machuruku_code.R

machu.treeplotR Documentation

Plot trees to visualize each step in the Machuruku process

Description

Visualize trees to help with interpreting Machuruku analysis and results. Will plot a single tree or multiple trees (i.e. the results of machu.tree.unc) on the same axis. Node numbers/IDs and divergence times can be visualized. Timeslices can be plotted to visualize which "branch-taxa" may be returned at a given time-slice.

Usage

machu.treeplot(
  tree,
  timeslice = NULL,
  nodelabs = T,
  nodelabsize = 0.5,
  col = "red",
  x.u.lim = NULL,
  x.l.lim = NULL,
  timelabs = T,
  timelabsize = 0.8,
  timelaboffset = -0.35,
  decimals = 2
)

Arguments

tree

Tree input. Can be a single tree in phylo format, or a list of trees. Untested with other formats.

timeslice

Numeric vector with the timeslices to plot, if any.

nodelabs

Whether to plot labels identifying each node. Default = T.

nodelabsize

This is given to the circle.exp arg of phytools::labelnodes(). Default = 0.5, which is optimized for simple trees.

col

Color of the timeslices. Default = "red".

x.u.lim

Upper limit of the x-axis (i.e. right side of plot). By default this is the order of magnitude of the tree height, which is usually enough to accommodate decently sized taxon names. If you have longer names you can manually adjust this value.

x.l.lim

Lower limit of the x-axis (i.e. left side of plot). By default this is scaled by the order of magnitude of the tree height. If you have your own scale in mind you can override the default.

timelabs

Whether to plot divergence time labels at each node. Default = T.

timelabsize

Size of div time labels. Default = 0.8, which is optimized for simple trees.

timelaboffset

Offset of div time labels from their respective nodes. Default = -0.35, which is optimized for simple trees. Making this number more negative will offset the labels further to the right.

decimals

Specify number of decimal places displayed in the node (divergence time) labels. Default = 2.

Details

This function tends to generate warnings that shouldn't affect the output. You can turn them off with options(warn=-1).

Value

Plots a tree or tree with node labels, divergence times, and time-slices.

Examples

# plot tree by itself
machu.treeplot(tree)
# plot with three timeslices
machu.treeplot(tree, c(1e6, 2e6, 3e6))

wxguillo/machuruku documentation built on Jan. 23, 2025, 3:25 p.m.