Skip to content

Commit

Permalink
handy fix to contMap & densityMap for short internal edges
Browse files Browse the repository at this point in the history
  • Loading branch information
liamrevell committed Jun 7, 2016
1 parent f7fc310 commit 489bb6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/contMap.R
@@ -1,5 +1,5 @@
# function plots reconstructed values for ancestral characters along the edges of the tree
# written by Liam J. Revell 2012, 2013, 2014, 2015
# written by Liam J. Revell 2012, 2013, 2014, 2015, 2016
contMap<-function(tree,x,res=100,fsize=NULL,ftype=NULL,lwd=4,legend=NULL,
lims=NULL,outline=TRUE,sig=3,type="phylogram",direction="rightwards",
plot=TRUE,...){
Expand Down Expand Up @@ -53,6 +53,7 @@ contMap<-function(tree,x,res=100,fsize=NULL,ftype=NULL,lwd=4,legend=NULL,
if(is.null(lims)) lims<-c(min(y),max(y))
trans<-0:1000/1000*(lims[2]-lims[1])+lims[1]
names(trans)<-0:1000
tree$maps<-vector(mode="list",length=nrow(tree$edge))
for(i in 1:nrow(tree$edge)){
XX<-cbind(c(H[i,1],steps[intersect(which(steps>H[i,1]),which(steps<H[i,2]))]),
c(steps[intersect(which(steps>H[i,1]),which(steps<H[i,2]))],H[i,2]))-H[i,1]
Expand Down
1 change: 1 addition & 0 deletions R/densityMap.R
Expand Up @@ -38,6 +38,7 @@ densityMap<-function(trees,res=100,fsize=NULL,ftype=NULL,lwd=3,check=FALSE,legen
}
H<-nodeHeights(tree)
message("sorry - this might take a while; please be patient")
tree$maps<-vector(mode="list",length=nrow(tree$edge))
for(i in 1:nrow(tree$edge)){
YY<-cbind(c(H[i,1],steps[intersect(which(steps>H[i,1]),which(steps<H[i,2]))]),
c(steps[intersect(which(steps>H[i,1]),which(steps<H[i,2]))],H[i,2]))-H[i,1]
Expand Down

0 comments on commit 489bb6e

Please sign in to comment.