annotate_balance: annotate_balance

View source: R/plot_utils.R

annotate_balanceR Documentation

annotate_balance

Description

annotate a balance oriented with respect to the PhILR transform. That is, you can specify labels for the numerator (up) and denominator (down).

Usage

annotate_balance(
  tr,
  coord,
  p = NULL,
  labels = c("+", "-"),
  offset = 0,
  offset.text = 0.03,
  bar = TRUE,
  barsize = 0.01,
  barfill = "darkgrey",
  geom = "text",
  ...
)

Arguments

tr

phylo object

coord

named internal node/balance to annotate

p

ggtree plot (tree layer), if NULL then a new plot will be created.

labels

label for the numerator and denominator of the balance respectively

offset

offset for bar (if bar=TRUE) from tips

offset.text

offset of text from bar (if bar=TRUE) or from tips (if bar=FALSE)

bar

logical, should bar for each clade be plotted

barsize

width of bar (if bar=TRUE)

barfill

fill of bar

geom

geom used to draw label (e.g., 'text' or 'label')

...

additional parameters passed to geom_rect and specified geom

Value

ggplot object

Author(s)

Justin Silverman

References

Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. Methods in Ecology and Evolution 2016, doi:10.1111/2041-210X.12628

Examples

tr <- named_rtree(10)

annotate_balance(tr, 'n4', size=7)
annotate_balance(tr, 'n4', size=7, barsize=0.04, barfill='darkgreen',
    offset.text=0.05, color='red')
annotate_balance(tr, 'n4', bar=FALSE, size=7)
annotate_balance(tr, 'n4', bar=TRUE, size=7, labels=c('Num', 'Denom'),
    offset.text=.3)
annotate_balance(tr, 'n4', bar=TRUE, geom='label', size=8, offset.text=0.1)

jsilve24/philr documentation built on Oct. 17, 2024, 4:59 p.m.