Tuesday, May 21, 2019

Fix to plotTree.wBars for fan-style trees

I've received a couple of reports that the popular phytools function plotTree.wBars is broken for type="fan".

Generally, the complaint looks as follows:

“ I have tried to use your plotTree.wBars function following exactly the example you have in your blog, but then I always get this error (I tried with my own data and I can only plot the bars with phylogram type but never with a fan type tree): "Error in plotTree(tree, type = "fan", ftype = if (tip.labels) "i" else "off", : object 'add' not found"

I can't explain how this happen, but I believe it is now fixed.

Let's see the error then load the function from source & try again:

library(phytools)
tree<-pbtree(n=100)
x<-fastBM(tree,bounds=c(0,Inf))
plotTree.wBars(tree,x,type="fan")
## Error in plotTree(tree, type = "fan", ftype = if (tip.labels) "i" else "off", : object 'add' not found
source("https://raw.githubusercontent.com/liamrevell/phytools/master/R/plotTree.wBars.R")
plotTree.wBars(tree,x,type="fan")

plot of chunk unnamed-chunk-1

This can also be fixed by updating phytools from GitHub using devtools.

No comments:

Post a Comment

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