Friday, March 15, 2013

Using plotBranchbyTrait to plot different style trees

A recent commenter pointed out something that I hadn't realized about the new phytools function, plotBranchbyTrait - that is, that it can be used to plot different styles of tree and that the branch coloring works (mostly) for all of them. This shouldn't have been a surprise - because, unlike most of my other tree plotting function, plotBranchbyTrait is really just a wrapper around ape's versatile plot.phylo function. Furthermore, I made a specific effort to migrate as much control of the operation of plot.phylo out to the phytools user. Nonetheless, it did not occur to me that plotBranchbyTrait(...,type="cladogram"), type="unrooted", or type="radial" would work or produce a nice looking result. In fact, they seem to work great - with one exception.... Here's a quick demo:

> tree<-pbtree(n=40)
> x<-fastBM(tree)
> plotBranchbyTrait(tree,x,mode="tips",type="cladogram", legend=F)
> plotBranchbyTrait(tree,x,mode="tips",type="unrooted", legend=F)

The only one that doesn't seem to work out quite right (as pointed out by Jonathan) is type="fan", where the 'horizontal' lines in the graph (actually, here circular lines) plot black:
> plotBranchbyTrait(tree,x,mode="tips",type="fan",legend=F)

1 comment:

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