Skip to content

Commit

Permalink
changed y-xis order to help with legend AND made fossisl obey arg "li…
Browse files Browse the repository at this point in the history
…neageColors"
  • Loading branch information
mjanuario committed Aug 25, 2023
1 parent 419fa5d commit 83056a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/draw.sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ draw.sim <- function (sim, traits = NULL, fossils = NULL, lineageColors = NULL,

# limits in y axis
if (!("ylim" %in% names(args))) {
formals(plot.default)$ylim <- c(0, (length(sim$TE) + 1))
formals(plot.default)$ylim <- c((length(sim$TE) + 1),0)
}

# no frame
Expand Down Expand Up @@ -582,9 +582,14 @@ draw.sim <- function (sim, traits = NULL, fossils = NULL, lineageColors = NULL,

# and get their colors
colFossils <- traitColors[unlist(traitSummary[traitID]) + 1]
} else {
} else if(is.null(lineageColors)){
# otherwise, all red
colFossils <- rep("red", times = length(sim$TE))
}else{
if(length(lineageColors)!=length(sim$TE)){
stop("\"lineageColors\" and sim do not match. See \"draw.sim\" help page.")
}
colFossils <- lineageColors[as.numeric(sub("t","", fossils$Species))]
}

# check which fossils to draw
Expand Down

0 comments on commit 83056a3

Please sign in to comment.