From: paradis Date: Sat, 20 Dec 2008 16:45:04 +0000 (+0000) Subject: bug fixed in ltt.plot.R X-Git-Url: https://git.donarmstrong.com/?p=ape.git;a=commitdiff_plain;h=3f528bd2c47301b64ed03bd28039bbf22a7510ad bug fixed in ltt.plot.R git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@56 6e262413-ae40-0410-9e79-b911bd7a66b7 --- diff --git a/ChangeLog b/ChangeLog index 8891e33..5a22435 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ BUG FIXES multiple lines with different numbers of lines and/or with comments inserted within the trees). + o ltt.plot(), ltt.lines(), and mltt.plot() did not count correctly + the number of lineages with non-binary trees. + CHANGES IN APE VERSION 2.2-2 diff --git a/DESCRIPTION b/DESCRIPTION index 74b1a1d..7c5ae46 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.2-3 -Date: 2008-11-24 +Date: 2008-12-20 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, diff --git a/R/ltt.plot.R b/R/ltt.plot.R index 2a0179c..6421e8b 100644 --- a/R/ltt.plot.R +++ b/R/ltt.plot.R @@ -1,4 +1,4 @@ -## ltt.plot.R (2008-02-22) +## ltt.plot.R (2008-12-20) ## Lineages Through Time Plot @@ -10,6 +10,7 @@ ltt.plot <- function(phy, xlab = "Time", ylab = "N", ...) { if (class(phy) != "phylo") stop('object "phy" is not of class "phylo"') + if (!is.binary.tree(phy)) phy <- multi2di(phy) time <- sort(branching.times(phy), decreasing = TRUE) N <- 1:(length(time) + 1) plot.default(-c(time, 0), N, xlab = xlab, ylab = ylab, @@ -18,6 +19,7 @@ ltt.plot <- function(phy, xlab = "Time", ylab = "N", ...) ltt.lines <- function(phy, ...) { + if (!is.binary.tree(phy)) phy <- multi2di(phy) time <- sort(branching.times(phy), decreasing = TRUE) N <- 1:(length(time) + 1) lines(-c(time, 0), N, type = "S", ...) @@ -27,6 +29,7 @@ mltt.plot <- function(phy, ..., dcol = TRUE, dlty = FALSE, legend = TRUE, xlab = "Time", ylab = "N", log = "") { ltt.xy <- function(phy) { + if (!is.binary.tree(phy)) phy <- multi2di(phy) x <- -c(sort(branching.times(phy), decreasing = TRUE), 0) names(x) <- NULL y <- 1:length(x)