ggtree
ggtree copied to clipboard
How to automatically highlight different branch using different categories in tree?
Dear Pro. Yu I manually highlighted several branches belonging to one taxonomy in tree using the geom_hilight() function (such as frame1 in image 1). But it was low efficient when I want to highlight many taxonomies. So, how can I automatically highlight all branches belonging to varied taxonomy? In addition, in frame2 in image 1, I framed several nodes, which belong to one taxonomy level. I want to automatically highlight the nodes, but I failed. The result was these nodes have different highlighted pwidth (frame 2 in image 1), and it looks bad. And when I highlighted them using their parent nodes 68 (or 73), all (or almost) nodes in the tree were colored to one color (image 2), which also confused me. So, is there has any way to solve these two questions?
Best, Hall Wang
The present codes are:
p <- ggtree(tree, layout="circular", branch.length='none')+ geom_tippoint(aes(color=group),size=1.5, show.legend=FALSE)
p1 <- p + geom_hilight(node = 78, fill = "#e31a1c", alpha = 0.8, extend = 0.1)+ geom_hilight(node = c(69,1,66,67), fill = "#fdbf6f", alpha = 0.8, extend = 0.1)
p1 <- p + geom_hilight(node = 68, fill = "#229f8a", alpha = 0.2, extend = 0.43)
The images are:
