I just added a new function cladelabels to the phytools package. This function is in some ways analogous to nodelabels, tiplabels, etc. in ape. It basically implements the method I gave here, while taking advantage of the trick described here.
The code for this function is here, and it is also in a new phytools version, which can be downloaded here.
Here's a demo:
plotTree(tree) ## also can use plot.phylo
Now let's label the three clades descended from nodes 46 & 33; and then also node 28 (which is inclusive of node 33:
Cool - this was more or less what we were going for. We can also do this without sending cladelabels the tree, although in this case we need to provide some guidance on the space that cladelabels should leave for tip labels - otherwise it will assume a fixed width of 8 characters.
## delete the tree! (we really don't need it)
It's also fairly obvious how this could be combined with findMRCA to label clades on the basis of the taxa in the clade, rather than their specific MRCA node number. For instance:
Finally, it's possible to send the function multiple node numbers & clade labels in one function call - although at present this does not permit us to use different offset values. So:
## is the same as:
cladelabels(tree,node=c(49,34),text=c("Clade A","Clade B"))
One caveat important to mention is that at present this works only for rightward facing phylograms (or cladograms, for tree=NULL). This is not theoretically difficult to extend to other plot types, it just requires more work.
This seems like a really nice and easy way of doing exactly what I need to do. Only problem is that R cannot find the cladelabel function?
I installed the latest version of the phytools package but it doesn't seem to work...
This is not yet on CRAN. You need to install from source after downloading from here. Let me know if you are not able to install from source & can post a Windows binary version. (At this time I cannot post a Mac OS X binary version.) -- LiamDelete
Sorry, my bad. Just downloaded it and works perfectly!
Thanks very much.
Would be great if it could be modified for type="fan" too ;-)