Tuesday, October 25, 2016

Bug fix for color bar in "contMap" & "densityMap" plots

It was recently reported to me that the color gradient legend labels in the plotting method for "contMap" are messed up. This was evidently due to a bug I introduced the option to plot the color legend vertically.

I just pushed a bug fix (which is basically just a deletion of the introduced bug.

First, here is the bug:

library(phytools)
obj<-contMap(tree,x,plot=FALSE)
plot(obj,legend=2.1)

plot of chunk unnamed-chunk-1

Note the rightmost legend label is 'floating' too high about the legend line.

Now the fix. Since the function add.color.bar is called internally, R won't use it unless we load the source code of the other functions as well:

source("https://raw.githubusercontent.com/liamrevell/phytools/master/R/plotBranchbyTrait.R")
source("https://raw.githubusercontent.com/liamrevell/phytools/master/R/densityMap.R")
source("https://raw.githubusercontent.com/liamrevell/phytools/master/R/contMap.R")
plot(obj,legend=2.1)

plot of chunk unnamed-chunk-2

This can also be installed from GitHub of course:

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

No comments:

Post a Comment