Monday, July 20, 2020

Mapping a continuous trait onto the branches of a phylogeny using variable edge widths: Part IV

A couple of days ago I posted some code showing how to plot a right- (or left-) facing phylogram with polygons for branches.

As of this afternoon, I have just pushed these new functions to the phytools GitHub page. This update can be obtained by downloading & installing phytools directly from GitHub using devtools.

library(devtools)
install_github("liamrevell/phytools")

Beyond what I showed yesterday, the major feature that I added was the option to turn on borders around our polygons, and the option to plot the vertical lines connecting edges as simple lines (that is, without width).

Here's an example:

data(sunfish.tree)
data(sunfish.data)
buccal.length<-setNames(sunfish.data$buccal.length,
    rownames(sunfish.data))
bl.object<-edge.widthMap(sunfish.tree,buccal.length)
plot(bl.object,fsize=0.9,max.width=0.8,
    legend="relative buccal length",
    color=palette()[4],min.width=0.05,border="black",
    lwd=3)