plt_recpd_ape | R Documentation |
The version of plt_recpd
which uses tree plotting functions from plot.phylo
.
plt_recpd_ape( res, feat, test = "a", branch.lengths = TRUE, axis = FALSE, map = c("anc_new", "anc_old"), direction = c("rightwards", "downwards") )
res |
A results data.frame generated by recpd_calc(). |
feat |
A user-provided array of at least length 2, containing named features, or indices, corresponding to the feature column/rows of the recpd_calc() results data.frame. |
test |
Tree mappings to plot. An array: all ('a'), none ('-a'); or combinations of tips ('t'), nodes ('n'), or branches ('b'). |
branch.lengths |
logical. Use branch.lengths (TRUE), or plot in willow tree format (FALSE). |
axis |
logical. Add a y-axis of branch length to root distance. |
map |
Use finalized RecPD ancestral lineages ('anc_new') or preliminary state mappings ('anc_old') |
direction |
Plot tree in vertical ('downwards') or horizontal ('rightwards') orientation. |
A list returned by plot.phylo
.
Cedoljub Bundalovic-Torma
plt_recpd
for the ggtree version.
library(ape) library(dplyr) library(ggplot2) ##Test case for a randomly generated tree (10 tips) and 10 randomly generated ##feature presence/absence (1, 0) data.frame. #Generate a random phylogenetic tree: n_tip <- 10 tree <- rtree(n_tip) #Generate 10 randomly distributed features (rows = features, columns = #phylogenetic tree tips): tab <- replicate(10, sapply(10, function(x) sample(c(0,1), x, replace=TRUE)), simplify='matrix') %>% t() %>% data.frame(check.names=FALSE) %>% rename_with(function(x) tree$tip.label[as.numeric(x)]) #Perform ancestral lineage reconstruction with recpd_calc(): #res <- recpd_calc(tree, tab, calc=TRUE) #plt_recpd_ape(res, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.