Description Usage Arguments Details Value References Examples
After re-rooting a tree, the order of tips when the tree is plotted no longer match the order of $tip.label. Use this function to get tips in the order they are plotted.
1 |
tree |
Phylognetic tree (list of class "phylo") |
Note that this is not compatible with ggtree! The same tree plotted with ggtree and ape may have slightly different tip order.
To get tip order of a ggtree plot, do something like this: data(bird.orders) p <- ggtree::ggtree(bird.orders) p[["data"]] # extract 'label' and 'y' columns
Vector
https://stackoverflow.com/questions/34364660/how-to-get-correct-order-of-tip-labels-in-ape-after-calling-ladderize-function
1 2 3 4 5 6 7 8 9 10 | library(ape)
data(bird.orders)
plot(bird.orders, no.margin = TRUE)
bird.orders$tip.label # matches plot
bird.orders_reroot <- root(bird.orders, 5)
plot(bird.orders_reroot)
# Tip order still the same even though the tree
# has been re-rooted!
all.equal(bird.orders_reroot$tip.label, bird.orders$tip.label)
get_tips_in_ape_plot_order(bird.orders_reroot) # matches order in plot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.