[Vegan-commits] r2548 - in branches/2.0: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jul 10 10:04:46 CEST 2013
Author: jarioksa
Date: 2013-07-10 10:04:46 +0200 (Wed, 10 Jul 2013)
New Revision: 2548
Added:
branches/2.0/R/plot.ordipointlabel.R
Modified:
branches/2.0/NAMESPACE
branches/2.0/R/indpower.R
branches/2.0/R/ordilabel.R
branches/2.0/inst/ChangeLog
branches/2.0/man/ordipointlabel.Rd
Log:
merge small things skipped earlier, among them add plot.ordipointlabel
Modified: branches/2.0/NAMESPACE
===================================================================
--- branches/2.0/NAMESPACE 2013-07-09 13:54:12 UTC (rev 2547)
+++ branches/2.0/NAMESPACE 2013-07-10 08:04:46 UTC (rev 2548)
@@ -254,6 +254,7 @@
S3method(plot, nestednodf)
S3method(plot, nestedtemp)
S3method(plot, ordisurf)
+S3method(plot, ordipointlabel)
S3method(plot, orditkplot)
S3method(plot, permat)
S3method(plot, poolaccum)
Modified: branches/2.0/R/indpower.R
===================================================================
--- branches/2.0/R/indpower.R 2013-07-09 13:54:12 UTC (rev 2547)
+++ branches/2.0/R/indpower.R 2013-07-10 08:04:46 UTC (rev 2548)
@@ -8,7 +8,7 @@
if (!(type %in% 0:2))
stop("'type' must be in c(0, 1, 2)")
n <- nrow(x)
- j <- t(x) %*% x
+ j <- crossprod(x) ## faster t(x) %*% x
ip1 <- sweep(j, 1, diag(j), "/")
ip2 <- 1 - sweep(-sweep(j, 2, diag(j), "-"), 1, n - diag(j), "/")
out <- switch(as.character(type),
Modified: branches/2.0/R/ordilabel.R
===================================================================
--- branches/2.0/R/ordilabel.R 2013-07-09 13:54:12 UTC (rev 2547)
+++ branches/2.0/R/ordilabel.R 2013-07-10 08:04:46 UTC (rev 2548)
@@ -29,10 +29,6 @@
else
col <- par("fg")
for (i in 1:nrow(x)) {
- ## polygon(x[i,1] + c(-1,1,1,-1)*w[i], x[i,2] + c(-1,-1,1,1)*h[i],
- ## col = fill, border = border, xpd = xpd)
- ## text(x[i,1], x[i,2], labels = labels[i], cex = cex, col = col,
- ## xpd = xpd, ...)
ordiArgAbsorber(x[i,1] + c(-1,1,1,-1)*w[i], x[i,2] + c(-1,-1,1,1)*h[i],
col = fill, border = border, xpd = xpd,
FUN = polygon, ...)
Copied: branches/2.0/R/plot.ordipointlabel.R (from rev 2541, pkg/vegan/R/plot.ordipointlabel.R)
===================================================================
--- branches/2.0/R/plot.ordipointlabel.R (rev 0)
+++ branches/2.0/R/plot.ordipointlabel.R 2013-07-10 08:04:46 UTC (rev 2548)
@@ -0,0 +1,11 @@
+plot.ordipointlabel <- function (x, ...)
+{
+ plot(x$points, pch = x$args$pch, cex = x$args$pcex, col = x$args$pcol,
+ bg = x$args$pbg, asp = 1, ...)
+ font <- attr(x$labels, "font")
+ if (is.null(font))
+ font <- par("font")
+ text(x$labels, rownames(x$labels), cex = x$args$tcex, col = x$args$tcol,
+ font = font, ...)
+ invisible(x)
+}
Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog 2013-07-09 13:54:12 UTC (rev 2547)
+++ branches/2.0/inst/ChangeLog 2013-07-10 08:04:46 UTC (rev 2548)
@@ -7,12 +7,15 @@
* merge r2540: remove hard-coded inconsolata fonts.
* merge r2539: stressplot return data in input order.
* merge r2538: use expression(R^2) in stressplot.
+ * merge r2537, 2541: add plot.ordipointlabel.
* merge r2535, 2536: better positioning of arrow labels.
* merge r2534: lwd in ordisurf.
* merge r2533: ordipointlabel uses ordiArgAbsorber.
+ * merge r2532: clean up ordilabel.
* merge r2504: notation in adipart.Rd.
* merge r2498: adapt raupcrick to r2495.
* merge r2497: avoid visible ~ in .Rnw.
+ * merge r2496: use crossprod() in indpower.
* merge r2495: fix twisted test direction in oecosimu.
* merge r2490 thru 2493: ordisurf new options.
* merge r2484 thru 2486: betadisper fixes (centroid with one
Modified: branches/2.0/man/ordipointlabel.Rd
===================================================================
--- branches/2.0/man/ordipointlabel.Rd 2013-07-09 13:54:12 UTC (rev 2547)
+++ branches/2.0/man/ordipointlabel.Rd 2013-07-10 08:04:46 UTC (rev 2548)
@@ -1,5 +1,6 @@
\name{ordipointlabel}
\alias{ordipointlabel}
+\alias{plot.ordipointlabel}
\title{ Ordination Plots with Points and Optimized Locations for Text }
\description{
@@ -13,10 +14,14 @@
ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
col = c(1, 2), pch = c("o", "+"), font = c(1, 1),
cex = c(0.8, 0.8), add = FALSE, select, ...)
+
+\method{plot}{ordipointlabel}(x, ...)
}
\arguments{
- \item{x}{A result object from ordination. }
+ \item{x}{For \code{ordipointlabel()} a result object from an
+ ordination function. For \code{plot.ordipointlabel} an object
+ resulting from a call to \code{ordipointlabel()}.}
\item{display}{Scores displayed in the plot. }
\item{choices}{Axes shown. }
\item{col, pch, font, cex}{Colours, point types, font style and
@@ -56,9 +61,14 @@
label. In addition, it returns the result of \code{\link{optim}} as
an attribute \code{"optim"}. The unit of overlap is the area
of character \code{"m"}, and with variable \code{cex} it is the
- smallest alternative. The result object inherits from
- \code{\link{orditkplot}} result, and can be replotted with its
- \code{plot} command. It may be possible to further edit the result
+ smallest alternative.
+
+ There is a \code{plot} method based on \code{orditkplot} but which
+ does not alter nor reset the graphical parameters via \code{par}.
+
+ The result object from \code{ordipointlabel} inherits from
+ \code{\link{orditkplot}}, and can also be replotted with its
+ \code{plot} method. It may be possible to further edit the result
object with \code{\link{orditkplot}}, but for good results it is
necessary that the points span the whole horizontal axis without empty
margins.
@@ -74,7 +84,7 @@
\examples{
data(dune)
ord <- cca(dune)
-ordipointlabel(ord)
+plt <- ordipointlabel(ord)
## set scaling - should be no warnings!
ordipointlabel(ord, scaling = 1)
@@ -83,6 +93,9 @@
plot(ord, scaling = 3, type = "n")
ordipointlabel(ord, display = "species", scaling = 3, add = TRUE)
ordipointlabel(ord, display = "sites", scaling = 3, add = TRUE)
+
+## redraw plot without rerunning SANN optimisation
+plot(plt)
}
\keyword{ hplot }
\keyword{ aplot }
More information about the Vegan-commits
mailing list