[Vegan-commits] r504 - in pkg: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 26 12:27:02 CEST 2008


Author: jarioksa
Date: 2008-09-26 12:27:02 +0200 (Fri, 26 Sep 2008)
New Revision: 504

Modified:
   pkg/R/ordipointlabel.R
   pkg/R/orditkplot.R
   pkg/R/plot.orditkplot.R
   pkg/inst/ChangeLog
   pkg/inst/NEWS
   pkg/man/ordipointlabel.Rd
   pkg/man/orditkplot.Rd
Log:
improved graphics transport from ordipointlabel to orditkplot

Modified: pkg/R/ordipointlabel.R
===================================================================
--- pkg/R/ordipointlabel.R	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/R/ordipointlabel.R	2008-09-26 10:27:02 UTC (rev 504)
@@ -83,13 +83,13 @@
     text(lab, labels=labels, col = col, cex = cex, font = font,  ...)
     pl <- list(points = xy)
     pl$labels <- lab
+    attr(pl$labels, "font") <- font
     args <- list(tcex = cex, tcol = col, pch = pch, pcol = col,
                  pbg = NA, pcex = cex)
     pl$args <- args
     pl$par <- par(no.readonly = TRUE)
-    pl$font <- font
+    pl$dim <- par("din")
     attr(pl, "optim") <- sol
     class(pl) <- c("ordipointlabel", "orditkplot", class(pl))
     invisible(pl)
 }
-

Modified: pkg/R/orditkplot.R
===================================================================
--- pkg/R/orditkplot.R	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/R/orditkplot.R	2008-09-26 10:27:02 UTC (rev 504)
@@ -293,7 +293,10 @@
     diam <- rep(diam, length=nr)
     labfam <- rep(labfam, length=nr)
     labsize <- rep(labsize, length=nr)
-    labfnt <- rep(p$font, length=nr)
+    if (inherits(x, "ordipointlabel"))
+        labfnt <- attr(x$labels, "font")
+    else
+        labfnt <- rep(p$font, length=nr)
     ## Select only items within xlim, ylim
     take <- rep(TRUE, nr)
     if (!missing(xlim))

Modified: pkg/R/plot.orditkplot.R
===================================================================
--- pkg/R/plot.orditkplot.R	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/R/plot.orditkplot.R	2008-09-26 10:27:02 UTC (rev 504)
@@ -5,7 +5,10 @@
     on.exit(par(op))
     plot(x$points, pch = x$args$pch, cex = x$args$pcex, col = x$args$pcol,
          bg = x$args$pbg, xlim = x$args$xlim, ylim = x$args$ylim, 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)
+         col = x$args$tcol, font = font)
     invisible(x)
 }

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/inst/ChangeLog	2008-09-26 10:27:02 UTC (rev 504)
@@ -26,6 +26,9 @@
 
 	* anova.cca(..., by = "margin") or function anova.ccabymargin
 	gained a 'scope' argument which is used in drop.scope(). 
+
+	* orditkplot & ordipointlabel: improved interface allows passing
+	font type from ordipointlabel to orditkplot. 
 	
 Version 1.14-11 (closed September 10, 2008)
 

Modified: pkg/inst/NEWS
===================================================================
--- pkg/inst/NEWS	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/inst/NEWS	2008-09-26 10:27:02 UTC (rev 504)
@@ -27,8 +27,7 @@
       relocated to avoid overplotting. The optimization uses simulated
       annealing of 'optim' function. Returns an "orditkplot" object so
       that the results can be edited with 'orditkplot'. Similar to
-      'pointLabel' function in maptools package.  FIXME: INTERFACE
-      WITH orditkplot NEEDS A FINISHING TOUCH.
+      'pointLabel' function in maptools package. 
 
     - permatfull, permatswap: functions to permute quantitative count
       data.
@@ -75,7 +74,6 @@
     - orditkplot: Improved user interface. Improved zooming into
       graphs. Imitates R plotting characters ('pch'). Label family,
       size and font can be vectors. 
-      FIXME: SHOULD BE ABLE TO EDIT ALL ordipointlabel RESULTS.
 
     - permuted.index2 and associated functions allow for restricted
       permutations of strata (i.e., restricted shuffling of blocks). 

Modified: pkg/man/ordipointlabel.Rd
===================================================================
--- pkg/man/ordipointlabel.Rd	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/man/ordipointlabel.Rd	2008-09-26 10:27:02 UTC (rev 504)
@@ -50,7 +50,12 @@
   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. 
+  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
+  object with \code{\link{oridtkplot}}, but for good results it is
+  necessary that the points span the whole horizontal axis without empty
+  margins. 
 }
 \references{ See \code{\link[maptools]{pointLabel}} for references. }
 \author{ Jari Oksanen }

Modified: pkg/man/orditkplot.Rd
===================================================================
--- pkg/man/orditkplot.Rd	2008-09-26 09:09:01 UTC (rev 503)
+++ pkg/man/orditkplot.Rd	2008-09-26 10:27:02 UTC (rev 504)
@@ -98,6 +98,13 @@
   \R plots, your plot must have the same dimensions as the
   \code{orditkplot} canvas to have identical location of the labels.
 
+  The function only displays one set of scores. However, you can use
+  \code{\link{ordipointlabel}} to produce a result object that has
+  different points and text types for several sets of scores and this
+  can further edited fith \code{orditkplot}. For a good starting
+  solution you need to scale the \code{\link{ordipointlabel}} result so
+  that the points span over the whole horizontal axis.
+
   The plot is a Tcl/Tk canvas, but the function tries to replicate
   standard graphical device of the platform, and it honours several
   graphical parameters (see \code{\link{par}}).  Many of the graphical
@@ -146,7 +153,12 @@
 \dontrun{
 data(varespec)
 ord <- cca(varespec)
+## Do something with the graph and end by clicking "Dismiss"
 orditkplot(ord, mar = c(4,4,1,1)+.1, font=3)
+## Use ordipointlabel to produce a plot that has both species and site
+## scores in different colors and plotting symbols
+pl <- ordipointlabel(ord)
+orditkplot(pl)
 }
 }
 \keyword{ iplot }



More information about the Vegan-commits mailing list