Sunday, March 3, 2013

New version of phylomorphospace with user control of x & y limits (and other things)

A phytools user today requested user control of x and y limits in phylomorphospace. Currently phylomorphospace sets xlim and ylim based on the range of tip and ancestral values for x & y and this can't be adjusted. It is straightforward to migrate control of this to the user, and I've done this through the "three-dot argument" (i.e., ...). I've also added user control of xlab and ylab, as well as fsize to control the font size of tip labels. fsize is relative to the default font size of textxy(...,cx=0.75).

Code for the new version of phylomorphospace is here, but because the function calls textxy in the 'calibrate' package internally, and phytools imports from calibrate, users will need to either load calibrate to run phylomorphospace from source, or they can install the newest minor build of phytools (phytools 0.2-24).

Here's a quick demo:
> require(phytools)
Loading required package: phytools
> packageVersion("phytools")
[1] ‘0.2.24’
> tree<-pbtree(n=30)
> XX<-fastBM(tree,nsim=2)
> par(mar=c(5.1,4.1,2.1,2.1))
> phylomorphospace(tree,XX) # default
> phylomorphospace(tree,XX,ylim=c(-3,4),xlim=c(-4.5,3.5), ylab="trait 1",xlab="trait 2")
That's it.


  1. Awesome! Thanks for doing this Liam. It'll be on display Wednesday when I give my continuous evolution tutorial at the Bodega Bay Applied Phylogenetics workshop.

  2. Is there a way to change the model of ancestral state reconstruction that phylomorphospace uses?

    1. No - but you can supply.ancestral states that are estimated using another method. This should be done using the argument A which should be a matrix of dimension tree$Nnode x 2, with row names that are the node numbers in the tree. Let me know if you need help with this. - Liam


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