attacher: %<+%

%<+%R Documentation

%<+%

Description

add annotation data to a tree

Usage

pg %<+% data

Arguments

pg

ggplot2 object

data

annotation data that contains a column of “node” , or the first column of taxa labels

Details

This operator attaches annotation data to a ggtree graphic object

Value

ggplot object with annotation data added

Author(s)

Guangchuang Yu

References

G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. https://doi.org/10.1093/molbev/msy194

See Also

geom_facet

Examples

nwk <- system.file("extdata", "sample.nwk", package="treeio")
tree <- read.tree(nwk)
p <- ggtree(tree)
dd <- data.frame(taxa=LETTERS[1:13],
   		 place=c(rep("GZ", 5), rep("HK", 3), rep("CZ", 4), NA),
             value=round(abs(rnorm(13, mean=70, sd=10)), digits=1))
row.names(dd) <- NULL
p %<+% dd + geom_text(aes(color=place, label=label), hjust=-0.5)

YuLab-SMU/ggtree documentation built on April 15, 2024, 5:19 p.m.