Wednesday, December 9, 2015

User control of legend width in contMap & densityMap plots

I just pushed a small series of updates to phytools to allow the functions contMap and densityMap (and their associated) S3 plotting methods) to use different line widths for the tree & legend.

This makes a lot of sense - because in some cases (such as for large trees) we might want to use very slender lines for the edges of the tree - but the legend can still be thick so that the color translation to phenotype is clear.

Here's a very quick demo:

library(phytools)
## Loading required package: ape
## Loading required package: maps
## 
##  # ATTENTION: maps v3.0 has an updated 'world' map.        #
##  # Many country borders and names have changed since 1990. #
##  # Type '?world' or 'news(package="maps")'. See README_v3. #
packageVersion("phytools")
## [1] '0.5.9'
tree<-pbtree(n=200,scale=10)
x<-fastBM(tree)
obj<-contMap(tree,x,plot=FALSE)
## change the color map:
obj<-setMap(obj,invert=TRUE)
plot(obj,ftype="off",fsize=c(0,0.9),lwd=c(2,7),
    outline=FALSE,legend=4)

plot of chunk unnamed-chunk-1

That's it. This release of phytools can be installed directly from GitHub using the devtools package as follows:

library(devtools)
install_github("liamrevell/phytools")

No comments:

Post a Comment

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