I want to label a specific branch (e.g., "Group 1") on the tree, but I didn't found a specific function to do that. Any ideas?
set.seed(123)
tree <- rtree(30)
plot(tree)
You're not actually using ggtree
to plot here. If you wish to draw your tree with ggtree
you could do something like this:
library(ggtree)
library(ggplot2)
set.seed(123)
tree <- rtree(30)
ggplot(tree) +
geom_tree() +
geom_tiplab() +
geom_text(aes(0.5, 20), label = 'Group 1',
check_overlap = TRUE, color = 'red', size = 6) +
theme_void()