Sunday, June 4, 2017

Function to set custom tip-spacing for subtrees of a plotted tree now in phytools (along with custom plot and print methods)

Earlier today I posted about a general method to expand or contract the tip-spacing of all the taxa descended from a particular node or set of nodes.

Now, this function has been added to the phytools package, along with a pair of S3 methods to print & plot the computed object.

The plot method I hadn't thought of earlier. All it does is use do.call internally to send any arguments we give the method to plotTree or plotSimmap internally, depending on the tree object class. This means that any argument of plotTree or plotSimmap can also be passed to the S3 plot method for the object class "expand.clade".

For instance:

library(phytools)
packageVersion("phytools")
## [1] '0.6.15'
obj
## An object of class "expand.clade" consisting of:
## (1) A phylogenetic tree (x$tree) with 100 tips and
##     99 internal nodes.
## (2) A vector (x$tips) containing the desired tip-spacing.
obj$tree
## 
## Phylogenetic tree with 100 tips and 99 internal nodes.
## 
## Tip labels:
##  t4, t30, t47, t86, t87, t97, ...
## 
## The tree includes a mapped, 2-state discrete character with states:
##  a, b
## 
## Rooted; includes branch lengths.
colors
##      a      b 
## "blue"  "red"
plot(obj,colors=colors,ftype="off",direction="downwards")

plot of chunk unnamed-chunk-1

That's all for now.

1 comment:

  1. Customize a website with the help of customized templates is called custom website development. If you want to customized your website you will need an expert of custom website development. Because an expert can full fill your demand. Best custom website development

    ReplyDelete

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