Saturday, May 25, 2013

Some minor improvements to plotSimmap(...,type="fan") and a few other updates

I just posted a new version of plotSimmap and a new minor phytools version (phytools 0.2-74). The updates mainly do the following: (1) allows user control over close to the full range of plotting options in from plotSimmap(..., type="phylogram"); (2) change the shape of the line caps from round to square (to bring into alignment with plotSimmap(...,type="phylogram") and common sense); (3) improve the alignment of labels with the terminal edge their offset from the tips; and, finally, (4) fix some problems where not enough space was left around the plotted trees to allow the labels to be added (this also seems to affect plot.phylo(...,type="fan")).

The result looks very nice. Here's a quick demo using the phylogeny of 100 Greater Antillean anoles from Mahler et al. (2010) and a stochastic mapping of "ecomorph class" (including non-ecomorph species) on the tree. leg gives the color→ecomorph translation.

> require(phytools)
Loading required package: phytools
> packageVersion("phytools")
[1] ‘0.2.74’
> data(anoletree) # load tree
> states<-sort(unique(getStates(anoletree))) # get states
> # set color legend
> leg<-setNames(palette()[1:7],c(states[3],states[-3]))
> leg
Non-    CG    GB       TC     TG     Tr        TW
"black" "red" "green3" "blue" "cyan" "magenta" "yellow"
> # ok - here is a trick to plot an outline around the tree
> par(col="white")
> plotTree(anoletree,type="fan",lwd=4,mar=rep(0,4), fsize=0.8)

Note: type="fan" is in development.
Many options of type="phylogram" are not yet available.

> par(col="black")
> plotSimmap(anoletree,leg,type="fan",lwd=2,mar=rep(0,4), add=TRUE,fsize=0.8)

Note: type="fan" is in development.
Many options of type="phylogram" are not yet available.



(Click for highest resolution.)

Cool.

I also now allow type="fan" trees to be plotted from plotTree, which uses plotSimmap internally.

No comments:

Post a Comment