You can’t even begin to understand biology, you can’t understand life, unless you understand what it’s all there for, how it arose - and that means evolution.

— Richard Dawkins


The book is meant as a guide for data integration, manipulation and visualization of phylogenetic trees using a suite of R packages, tidytree, treeio and ggtree. Hence, if you are starting to read this book, we assume you have a working knowledge of how to use R and ggplot2.


If you use the software suite in published research, please cite the most appropriate paper(s) from this list:

  1. G Yu. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics, 2020, 69:e96. doi: 10.1002/cpbi.96.
  2. LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu*. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. Molecular Biology and Evolution. 2020, 37(2):599-603. doi: 10.1093/molbev/msz240.
  3. G Yu*, TTY Lam, H Zhu, Y Guan*. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution. 2018, 35(2):3041-3043. doi: 10.1093/molbev/msy194.
  4. 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. 2017, 8(1):28-36. doi: 10.1111/2041-210X.12628.

Book structure

  • Part 1 (Tree data input, output and manipulation) describes treeio package for tree data input and output, and tidytree package for tree data manipulation.
  • Part 2 (Tree data visualization and annotation) introduces tree visualization and annotation using grammar of graphic syntax implemented in the ggtree package. It emphasizes on presenting tree associated data on the tree.
  • Part 3 (Miscellaneous topics) describes utitlies provided by the ggtree package suite, presents a set of reproducible examples and introduces some of the ggtree extensions.

Want to help?

The book’s source code is hosted on GitHub, at Any feedbacks on the book is very welcome. Feel free to open an issue on GitHub or send me a pull request if you notice typos or other issues (I’m not a native English speaker ;) ).