Question: How do I annotate a tree with boostrap scores and color code clades in ggtree?
gravatar for Namenlos
16 months ago by
Namenlos0 wrote:

I want to annotate a phylogenetic tree with bootstrap and add color to certain clades in ggtree. Something goes wrong when I try to do both, which has something to do with the indices of the internal nodes.

Here is a random tree with 24 tips:

 rtree <- rtree(24)

The following identifies the nodes to which I want to assign different colors:

rtree.clade <- groupClade(rtree, c(44, 37, 29))

These are the bootstrap scores: <- c(1000,  918,  966,  997,  661,  631,  711, 1000,  980,  991,  999,  998, 1000, 1000,  990, 1000,  980, 1000, 
899, 755, 654, 908, 334)

In the following two trees, the bootstrap scores do not show up on the same nodes:

#Tree with color added to clades
ggtree(rtree.clade, aes(color = group)) +
geom_tiplab() +
geom_nodelab(label =,
           geom = 'label')
#Tree with no color
ggtree(rtree.clade) +
geom_tiplab() +
geom_nodelab(label =,
           geom = 'label')

In the tree without color, the bootstrap scores have been assigned to the correct nodes. It is the tree with color that is incorrect. What am I doing wrong?

ggtree bootstrap phylogenetics R • 1.5k views
ADD COMMENTlink modified 15 months ago by Guangchuang Yu2.4k • written 16 months ago by Namenlos0
gravatar for Guangchuang Yu
15 months ago by
Guangchuang Yu2.4k
China/Guangzhou/Southern Medical University
Guangchuang Yu2.4k wrote:

see an example in for integrating bootstrap value.

For data integration, we have published a paper,, with lots of examples in the supplemental files.

ADD COMMENTlink written 15 months ago by Guangchuang Yu2.4k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1227 users visited in the last hour