Visualizing trees of many genes quickly with ggtree can be executed using the following steps:
- Load the libraries and get a phylo object of the Newick tree:
library(ggplot2)
library(ggtree)
itol <-ape::read.tree(file.path(getwd(), "datasets", "ch4", "itol.nwk"))
- Make a basic tree plot:
ggtree(itol)
- Make a circular plot:
ggtree(itol, layout = "circular")
- Rotate and invert the tree:
ggtree(itol) + coord_flip() + scale_x_reverse()
- Add labels to the tree tips:
ggtree(itol) + geom_tiplab( color = "blue", size = 2)
- Make a strip of color to annotate a particular clade:
ggtree(itol, layout = "circular") + geom_strip(13,14, color="red", barsize = 1)
- Make a blob of color to highlight a particular clade:
ggtree(itol, layout = "unrooted") + geom_hilight_encircle(node = 11, fill = "steelblue")