[Vegan-commits] r2038 - in branches/2.0: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 7 08:37:02 CET 2012
Author: jarioksa
Date: 2012-01-07 08:37:01 +0100 (Sat, 07 Jan 2012)
New Revision: 2038
Modified:
branches/2.0/R/plot.cca.R
branches/2.0/inst/ChangeLog
Log:
merge r2035-7: more robust plot.cca
Modified: branches/2.0/R/plot.cca.R
===================================================================
--- branches/2.0/R/plot.cca.R 2012-01-06 07:49:47 UTC (rev 2037)
+++ branches/2.0/R/plot.cca.R 2012-01-07 07:37:01 UTC (rev 2038)
@@ -4,10 +4,12 @@
{
TYPES <- c("text", "points", "none")
g <- scores(x, choices, display, scaling, const)
+ if (length(g) == 0 || all(is.na(g)))
+ stop("nothing to plot: requested scores do not exist")
if (!is.list(g))
g <- list(default = g)
## Take care that there are names
- for (i in 1:length(g)) {
+ for (i in seq_len(length(g))) {
if (length(dim(g[[i]])) > 1)
rownames(g[[i]]) <- rownames(g[[i]], do.NULL = FALSE,
prefix = substr(names(g)[i], 1, 3))
@@ -54,6 +56,8 @@
if (missing(xlim))
xlim <- range(g$spe[, 1], g$sit[, 1], g$con[, 1], g$default[,1],
na.rm = TRUE)
+ if (!any(is.finite(xlim)))
+ stop("no finite scores to plot")
if (missing(ylim))
ylim <- range(g$spe[, 2], g$sit[, 2], g$con[, 2], g$default[,2],
na.rm = TRUE)
@@ -81,7 +85,7 @@
else if (type == "points")
points(g$constraints, pch = 2, cex = 0.7, col = "darkgreen")
}
- if (!is.null(g$biplot) && type != "none") {
+ if (!is.null(g$biplot) && nrow(g$biplot) > 0 && type != "none") {
if (length(display) > 1) {
mul <- ordiArrowMul(g$biplot)
}
Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog 2012-01-06 07:49:47 UTC (rev 2037)
+++ branches/2.0/inst/ChangeLog 2012-01-07 07:37:01 UTC (rev 2038)
@@ -4,6 +4,7 @@
Version 2.0-3 (opened November 13, 2011)
+ * merge r2035,6,7: more robust plot.cca.
* merge r2030: resurrect old ChangeLog entries.
* merge r2027,28,33: tweak oecosimu printed output.
* merge r2018,19,21: add nestedbetasor() & nestedbetajac().
More information about the Vegan-commits
mailing list