ggtree applies the concepts of grammar of graphic in phylogenetic tree presentation and make it easy to add multiple layers of text and even figures above a 🌲.

Here, I cartoonize a phylogenetic tree generated by ggtree with comicR, which is a funny package to generate comic (xkcd-like) graph in R. Have fun with ggtree and comicR.

library(htmltools) library(XML) library(gridSVG) library(comicR)

library(ggplot2)
library(ggtree)

p <- ggtree(rtree(30), layout="fan")  + 
geom_text(aes(label=label, angle=angle), size=5, color="purple", vjust=-0.3)


p
svg <- grid.export(name="")$svg
tagList(
tags$div(
id = "ggtree_comic",
tags$style("#ggtree_comic text {font-family:Chalkduster;}"),
HTML(saveXML(svg)),
comicR("#ggtree_comic", ff=5)
)
) %>% html_print

Citation

G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. Methods in Ecology and Evolution. doi:10.1111/2041-210X.12628.