Friday, May 27, 2016

Bug due to current version of plotrix; instructions for rolling back plotrix & preventing dependency installation; small update to plotting functions

There have been some user-reported issues with the phytools dependency plotrix that I'm still trying to figure out.

Basically, folks have reported (and I have experienced) plotting trees using dotTree and obtaining a result that looks something like this:

Obviously, this is no good.

While I figure this out what I'd recommend is installing the previous version of plotrix, which can be done from source in a new R session as follows:

install.packages(
"https://cran.r-project.org/src/contrib/Archive/plotrix/plotrix_3.6-1.tar.gz",
type="source")

The problem that remains is that if a newer version of phytools is installed from GitHub, the dependency packages will also be updated if a newer version can be found - except in our case, we don't want that! To avoid it, just do the following:

library(devtools)
install_github("liamrevell/phytools",dependencies=FALSE)

Note that to do this you should still first ensure that all the other phytools dependencies are installed & up-to-date!

I also added another small update to the internally used function phylogram, which in turn affects mostly dotTree, phylo.heatmap, and plot.cophylo. This update permits pts to be used instead of as a logical, to specify the relative point size of the plotted points at the tips of the tree. This value should be specified relative to 1 being the default, which is in turn determined by the plotted edge widths!

Here's a quick demo:

library(phytools)
dotTree(tree,X) ## the default

plot of chunk unnamed-chunk-3

dotTree(tree,X,pts=FALSE) ## turned off

plot of chunk unnamed-chunk-3

dotTree(tree,X,pts=0.7) ## smaller

plot of chunk unnamed-chunk-3

dotTree(tree,X,pts=1.5) ## larger)

plot of chunk unnamed-chunk-3

dotTree(tree,X,pts=1.2,lwd=2) ## different lwd

plot of chunk unnamed-chunk-3

You get the idea.

2 comments:

  1. Hi Liam,

    Although I always got error message when executing the command your described in the post to install the earlier version of plotrix, I did successfully installed it from downloaded .tar file. I am glad that dotTree works fine now. Thanks a lot for the prompt solution.

    Best,
    Cheng-Chiang

    ReplyDelete

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