treePlotter: Rboretum Tree Plot Generator

View source: R/treePlotter.R

treePlotterR Documentation

Rboretum Tree Plot Generator

Description

Given a phylo or multiPhylo object (tree), and some optional metadata, this ggtree wrapper returns a ggtree plot object, adjusted with possible arguments

Usage

treePlotter(
  tree,
  basic_plot,
  tree_support,
  plot_root_support,
  clade_support,
  geom_size,
  log_transform,
  scale_range,
  use_pies,
  pie_colors,
  pie_xnudge,
  pie_ynudge,
  pie_legend_position,
  branch_length,
  branch_weight,
  node_label,
  node_label_font_size,
  node_label_fontface,
  node_label_color,
  node_label_box,
  node_label_nudge,
  taxa_font_size,
  taxa_fontface,
  taxa_offset,
  xmax,
  xmin,
  reverse_x,
  to_color,
  colors,
  highlight_legend,
  color_branches,
  plot_title,
  plot_title_size,
  plot_title_fontface,
  legend_shape_size,
  legend_font_size,
  legend_title_size,
  geom_alpha,
  geom_color
)

Arguments

tree

Tree(s) to plot. Options include:

  • A single, rooted phylo object; or,

  • A rooted multiPhylo object where all trees share 3+ taxa [Only unique topologies plotted, from most to least common]

basic_plot

OPTIONAL: If providing a multiPhylo and TRUE, plot all trees as stored and disable support functions [Default: FALSE, plot unique topologies after pruning to common taxa]

tree_support

OPTIONAL: Output of getAlignmentSupport, including data from all clades in 'tree'

plot_root_support

OPTIONAL: If TRUE and plotting node support via 'tree_support', include root nodes [Default: FALSE, do not include support for root nodes]

clade_support

OPTIONAL: Output of getTreeClades(return_counts=TRUE), including data from all clades in 'tree'

geom_size

OPTIONAL: If plotting support via tree_support, how should geom_nodepoint (or pies) be sized? Options include:

  • Single numeric value: All geom_nodepoint geoms will be this size [Default: 4]

  • c(min,max): If used with tree_support, geoms will be sized based on the total support across datasets and rescaled between min and max.

log_transform

OPTIONAL: If TRUE and plotting tree_support, log transform values prior to rescaling [Default: FALSE]

scale_range

OPTIONAL: If plotting tree_support, supply a min and max of values to be scaled. Values outside this range will be displayed as the otherwise min/max geom size. [Default: scale all data]

use_pies

OPTIONAL: If TRUE and tree_support contains inforomation from 2+ datasets, data from tree_support will be displayed as an inset pie chart rather than a geom_nodepoint [Default: FALSE, use geom_nodepoint; DEACTIVATED WHEN clade_support IS PROVIDED]

pie_colors

OPTIONAL If plotting with pies, a vector of colors with one item per support column [Default: ggplot default colors]

pie_xnudge

OPTIONAL: Set ggtree pie label hjust [Default: 0]

pie_ynudge

OPTIONAL: Set ggtree pie label yjust [Default: 0]

pie_legend_position

OPTIONAL: Numerical vector of length four specifying legend xmin,xmax,ymin,ymax respectively. [Default = c(1,1,1,1); Necessary oddity of generating a legend for nodepie data]

branch_length

OPTIONAL: TRUE [plot tree(s) with branch lengths]; FALSE [Default: plot cladogram(s)]

branch_weight

OPTIONAL: Set ggtree branch thickness [Default: 1]

node_label

OPTIONAL: Choice of node labels include:

  • "bs": Bootstrap value [Default]

  • "none": No node labels

  • "node": Node number

  • "support": Raw total support count (Only with tree_support)

  • "clade": Percent of trees in clade_support that support this clade (Only with clade_support)

node_label_font_size

OPTIONAL: Set ggtree node label font size [Default: 5]

node_label_fontface

OPTIONAL: Set node label fontface. Options include:

  • "plain" [Default]

  • "bold"

  • "italic"

  • "bold.italic"

node_label_color

OPTIONAL: Set ggtree node label color [Default: 'black']

node_label_box

OPTIONAL: Set ggtree node label as a label with a white background [Default: TRUE]

node_label_nudge

OPTIONAL: Set ggtree node label nudge_x [Default: 0]

taxa_font_size

OPTIONAL: Set ggtree tip label font size [Default: 5]

taxa_fontface

OPTIONAL: Set tip label fontface. Options include:

  • "plain" [Default]

  • "bold"

  • "italic"

  • "bold.italic"

taxa_offset

OPTIONAL: Set ggtree tip label offset [Default: 0]

xmax

OPTIONAL: Set ggplot xlim upper limit (e.g if long tip labels run off plot)

xmin

OPTIONAL: Set ggplot xlim lower limit (Must be used along with xmax [Default: 0])

reverse_x

OPTIONAL: TRUE [plot tree with tips on left]; FALSE [Default: plot tree with tips on right]

to_color

OPTIONAL: Color tips or clades via:

  • Character vector of taxa, all to be colored the same color

  • List of groups of taxa, each of which will have their own color. List can be named for use with a legend (set highlight_legend == TRUE)

colors

OPTIONAL: Colors for clade highlighting. Must be hex or valid R colors. Provide a color for each group (1 if character vector, 1 for each group if named list) or default colors will be used.

highlight_legend

OPTIONAL: Include a legend for colored tips, given a list (disabled if providing clade_support); [Default: False: No highlight legend]

color_branches

OPTIONAL: If TRUE and coloring taxa or clades, color the branches rather than the tip labels [Default: FALSE, colorize tip labels; DEACTIVATED IF clade_support is provided]

plot_title

OPTIONAL: Character vector containing plot titles (1 per tree) [Default: No title for phylo, tree name for multiPhylo]

plot_title_size

OPTIONAL: Set ggplot title font size [Default: 14]

plot_title_fontface

OPTIONAL: Set ggplot title fontface

  • "plain"

  • "bold" [Default]

  • "italic"

  • "bold.italic"

legend_shape_size

OPTIONAL: ggplot2 size for legend icons [Default: 5]

legend_font_size

OPTIONAL: ggplot2 size for legend font [Default: 10]

legend_title_size

OPTIONAL: ggplot size for legend title [Default: 10]

geom_alpha

OPTIONAL: ggplot2 alpha value for geom_nodepoint (or pies) [Default: 0.9]

geom_color

OPTIONAL: ggplot2 color value for geom_nodepoint if clade_support not provided [Default: 'red']

Value

ggtree object or list of ggtree objects


BobLiterman/Rboretum documentation built on July 6, 2023, 7:46 p.m.