Monday, June 24, 2013

New versions of phytools 3D methods

In my Evolution 2013 meeting talk (which I will put online soon), I showed a couple of old 3D visualization methods: a three-dimensional projection of the tree into morphospace ("phylomorphospace"); and a 3D traitgram visualization method in which x & y are phenotypic trait axes, while z represents the time since the root.

To make the plots I made a few minor updates to the two functions in which these methods are implemented: phylomorphospace3d and fancyTree(...,type="traitgram3d"). These updates are in a new phytools version (phytools 0.2-87). Here's a quick demo of how to create these as .gifs:

> require(phytools)
Loading required package: phytools
> packageVersion("phytools")
[1] ‘0.2.87’
> # simulate tree & data
> tree<-pbtree(n=40)
> X<-fastBM(tree,nsim=3)
> # create 3D phylomorphospace
> xx<-phylomorphospace3d(tree,X)
> movie3d(xx,duration=20,dir=".",movie= "phylomorphospace3d")
Will create: ./phylomorphospace3d.gif
Executing: convert -delay 1x10 phylomorphospace3d*.png phylomorphospace3d.gif
Deleting frames.
> # create 3D traitgram
> xx<-fancyTree(tree,type="traitgram3d",X=X[,1:2])
> movie3d(xx,duration=20,dir=".",movie="traitgram3d")
Will create: ./traitgram3d.gif
Executing: convert -delay 1x10 traitgram3d*.png traitgram3d.gif
Deleting frames.

That's it for now.

1 comment:

  1. First of all, thanks for your work, it's awesome,
    Im asking if there 's any way to export a 3d obj file ?
    I tried using rgl writeObj, but fancyTree is a function.

    ReplyDelete

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