+ CHANGES IN APE VERSION 2.4-2
+
+
+NEW FEATURES
+
+ o add.scale.bar() has a new option 'ask' to draw interactively.
+
+
+BUG FIXES
+
+ o add.scale.bar() drew the bar outside the plotting region with the
+ default options with unrooted or radial trees.
+
+
+
CHANGES IN APE VERSION 2.4-1
o ace(type = "continuous", method = "ML") now avoids sigma² being
negative (which resulted in an error).
+ o nj() crashed with NA/NaN in the distance matrix: an error in now
+ returned.
+
CHANGES IN APE VERSION 2.4
Package: ape
-Version: 2.4-1
-Date: 2009-11-21
+Version: 2.4-2
+Date: 2009-12-16
Title: Analyses of Phylogenetics and Evolution
Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Gangolf Jobb, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Korbinian Strimmer, Damien de Vienne
Maintainer: Emmanuel Paradis <Emmanuel.Paradis@ird.fr>
-## nj.R (2009-07-10)
+## nj.R (2009-11-23)
## Neighbor-Joining Tree Estimation
nj <- function(X)
{
if (is.matrix(X)) X <- as.dist(X)
+ if (any(is.na(X)))
+ stop("missing values are not allowed in the distance matrix")
N <- attr(X, "Size")
labels <- attr(X, "Labels")
if (is.null(labels)) labels <- as.character(1:N)
-## scales.R (2009-10-02)
+## scales.R (2009-12-16)
## Add a Scale Bar or Axis to a Phylogeny Plot
## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.
-add.scale.bar <- function(x, y, length = NULL, ...)
+add.scale.bar <- function(x, y, length = NULL, ask = FALSE, ...)
{
lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
direc <- lastPP$direction
length <- eval(parse(text = paste("1e", nb.digit, sep = "")))
}
- if (missing(x) || missing(y))
- switch(direc,
- "rightwards" = {
- x <- 0
- y <- 1
- },
- "leftwards" = {
- x <- max(lastPP$xx)
- y <- 1
- },
- "upwards" = {
- x <- max(lastPP$xx)
- y <- 0
- },
- "downwards" = {
- x <- 1
- y <- max(lastPP$yy)
- })
+ if (ask) {
+ cat("\nClick where you want to draw the bar\n")
+ x <- unlist(locator(1))
+ y <- x[2]
+ x <- x[1]
+ } else if (missing(x) || missing(y)) {
+ if (lastPP$type %in% c("phylogram", "cladogram")) {
+ switch(direc,
+ "rightwards" = {
+ x <- 0
+ y <- 1
+ },
+ "leftwards" = {
+ x <- max(lastPP$xx)
+ y <- 1
+ },
+ "upwards" = {
+ x <- max(lastPP$xx)
+ y <- 0
+ },
+ "downwards" = {
+ x <- 1
+ y <- max(lastPP$yy)
+ })
+ } else {
+ direc <- "rightwards" # just to be sure for below
+ x <- lastPP$x.lim[1]
+ y <- lastPP$y.lim[1]
+ }
+ }
switch(direc,
"rightwards" = {
\alias{add.scale.bar}
\title{Add a Scale Bar to a Phylogeny Plot}
\usage{
-add.scale.bar(x, y, length = NULL, ...)
+add.scale.bar(x, y, length = NULL, ask = FALSE, ...)
}
\arguments{
\item{x}{x location of the bar (can be left missing).}
\item{y}{y location of the bar (can be left missing).}
\item{length}{a numeric value giving the length of the scale bar. If
none is supplied, a value is calculated from the data.}
+ \item{ask}{a logical; if \code{TRUE} the user is asked to click where
+ to draw the bar. The default is \code{FALSE}.}
\item{\dots}{further arguments to be passed to \code{text}.}
}
\description{