I have a phylogenetic tree of the class phylo
with 24 tips and 23 internal nodes. I ran a bootstrap analysis on this tree and the data using boot.phylo
, which returned a vector of 23 bootstrap values. I created a ggtree object from my original tree and am now trying to add the bootstrap values to the nodes. I am doing something wrong but I don't know what.
Here is what I did:
gg.tr <- ggtree(mp.tree)
gg.tr + geom_label2(aes(subset=!isTip, label=bphylo$BP))
bphylo$BP
is the vector of 23 bootstrap values. When I run this code, I get the following error:
Error: Aesthetics must be either length 1 or the same as the data (47): subset, label, x, y
I don't understand this error, because I only want to put the bootstrap values on 23 of the possible 47 locations.
When I call the following function, I get a value of 23:
length(which(gg.tr$data$isTip==FALSE))
If the length of gg.tr$data$isTip==FALSE
is 23 and I have 23 bootstrap values, why am I getting an error telling me that my label is the wrong length?