Quantcast
Channel: Phylogenetic Tools for Comparative Biology
Viewing all articles
Browse latest Browse all 805

My favorite under-used phytools function

$
0
0

My phytools R package gets quite a lot of use. At the time of writing (according to Google Scholar), the paper describing phytools has been cited an astonishing 5,433times!

Still, many functions of the package get more use than others! I think perhaps the most popular are make.simmap (for stochastic mapping), densityMap and contMap (for graphing), fitPagel (for Pagel's 1994 binary character correlation method), and phylosig (for measuring phylogenetic signal).

Exactly no one asked, but maybe my favorite under-utilizedphytools function is the fun (IMO) edge.widthMap.

Here's a quick reminder of how it works.

library(phytools)
packageVersion("phytools")
## [1] '1.0.1'
data(mammal.tree)
mammal.tree<-ladderize(mammal.tree)
data(mammal.data)
lnMass<-setNames(log(mammal.data$bodyMass),
rownames(mammal.data))
bodyMass.map<-edge.widthMap(mammal.tree,lnMass)
plot(bodyMass.map,border="black",color="goldenrod",
legend="log(body mass)")

plot of chunk unnamed-chunk-1

I just love that!

Note that it's really important to export this plot as a high-res graphic or line art, because in the R default graphical device it invariably appears super blocky & ugly!

We also have the option to show vertical edges in our plot as simple lines and that looks pretty fun as well.

lnHomeRange<-setNames(log(mammal.data$homeRange),
rownames(mammal.data))
homeRange.map<-edge.widthMap(mammal.tree,lnHomeRange)
plot(homeRange.map,border="black",color=palette()[4],
legend="log(home range size)",vertical.as.polygon=FALSE,
lwd=1)

plot of chunk unnamed-chunk-2

Wacky!


Viewing all articles
Browse latest Browse all 805

Trending Articles