Thursday, December 23, 2021

Slanted cladogram tree style for co-phylogenetic plotting method in phytools

A phytools user writes:

“phytools has been a wonderfully helpful package, thanks for this! I have recently been using the cophylo function and have been finding that specifying the type parameter has no effect like it typically does in the plotSimmap function. I have tried the following:

plot(phytools::cophylo(tree1, tree2, assoc_table, type="cladogram"), 
    ftype="off", type = "cladogram")

or

cophylo1 <- phytools::cophylo(tree1, tree2, assoc_table, type="cladogram") 
plot.cophylo(cophylo1, ftype = "off", type="cladogram")

Any help would be greatly appreciated!”

Indeed, this functionality has not existed previously for the plot.cophylo method in phytools.

It wasn't too hard to include, however, so I just added it.

Here's a quick demo using a co-phylogenetic dataset from Lopez-Vaamonde et al. (2001).

library(phytools)
packageVersion("phytools")
## [1] '0.7.99'
## load data from Lopez-Vaamonde et al. (2001)
data(wasp.trees)
data(wasp.data)
## create co-phylogenetic object
wasp.cophylo<-cophylo(wasp.trees[[1]],wasp.trees[[2]],
    assoc=wasp.data)
## Rotating nodes to optimize matching...
## Done.
## plot co-phylogenies
plot(wasp.cophylo,link.type="curved",link.lwd=4,
     link.lty="solid",link.col=make.transparent("red",
     0.25),type="cladogram",part=0.45)

plot of chunk unnamed-chunk-1

Cool.

No comments:

Post a Comment

Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.