[Vegan-commits] r2567 - in pkg/vegan/inst: . doc

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 15 21:39:04 CEST 2013


Author: jarioksa
Date: 2013-07-15 21:39:03 +0200 (Mon, 15 Jul 2013)
New Revision: 2567

Modified:
   pkg/vegan/inst/ChangeLog
   pkg/vegan/inst/doc/decision-vegan.Rnw
   pkg/vegan/inst/doc/diversity-vegan.Rnw
   pkg/vegan/inst/doc/intro-vegan.Rnw
Log:
new formatting of vignettes with standard article class, and diversity and decision in two columns

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-07-15 19:30:46 UTC (rev 2566)
+++ pkg/vegan/inst/ChangeLog	2013-07-15 19:39:03 UTC (rev 2567)
@@ -16,6 +16,15 @@
 	* orditkplot: bmp has been available in unix-alike OSes since
 	2008, or a moth after writing orditkplot. Thanks to Brian Ripley
 	for informing us.
+
+	* vignettes: vignettes use now standard article style instead of
+	hacked jss style. Decision and diversity vignettes are in two
+	columns, but intro in one (R output did not fit in one
+	column). The common packages, macros and definitions were moved to
+	new vegan.sty which is written so that it should work both with
+	amsart and article, and with one and two columns. Figures are now
+	in standard figure environment, but intro redefines this to use
+	sidecaption figures.  
 	
 Version 2.1-31 (closed July 10, 2013)
 

Modified: pkg/vegan/inst/doc/decision-vegan.Rnw
===================================================================
--- pkg/vegan/inst/doc/decision-vegan.Rnw	2013-07-15 19:30:46 UTC (rev 2566)
+++ pkg/vegan/inst/doc/decision-vegan.Rnw	2013-07-15 19:39:03 UTC (rev 2567)
@@ -1,7 +1,7 @@
 % -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
 %\VignetteIndexEntry{Design decisions and implementation}
 
-\documentclass[a4paper,10pt]{amsart}
+\documentclass[a4paper,10pt,twocolumn]{article}
 \usepackage{vegan} % package options and redefinitions
 \usepackage[round]{natbib}
 \renewcommand{\cite}{\citep}
@@ -9,19 +9,20 @@
 \author{Jari Oksanen}
 \title{Design decisions and implementation details in vegan}
 
-\date{$ $Id$ $
+\date{\footnotesize{$ $Id$ $
   processed with vegan
 \Sexpr{packageDescription("vegan", field="Version")}
-in \Sexpr{R.version.string} on \today}
+in \Sexpr{R.version.string} on \today}}
 
-%% need no \usepackage{Sweave.sty}
+%% need no \usepackage{Sweave}
 \begin{document}
 \SweaveOpts{strip.white=true}
-\setkeys{Gin}{width=0.55\linewidth}
+\setkeys{Gin}{width=\linewidth}
 <<echo=false,results=hide>>=
 figset <- function() par(mar=c(4,4,1,1)+.1)
 options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+  ")
+options("prompt" = "> ", "continue" = "  ")
+options(width = 55) 
 require(vegan)
 @
 \maketitle
@@ -133,7 +134,8 @@
 library(parallel)
 clus <- makeCluster(4)
 clusterEvalQ(clus, library(vegan))
-mbc1 <- oecosimu(dune, meandist, "r2dtable", parallel = clus)
+mbc1 <- oecosimu(dune, meandist, "r2dtable", 
+                 parallel = clus)
 stopCluster(clus)
 @ 
 Socket clusters are used for parallel processing in Windows, but you
@@ -214,11 +216,12 @@
   \code{parallel} will be either an integer or a socket cluster, and
   information on the type is saved in variable \code{hasClus}:
 <<eval=false>>=
-    if (is.null(parallel) && getRversion() >= "2.15.0")
-        parallel <- get("default", envir = parallel:::.reg)
-    if (is.null(parallel) || getRversion() < "2.14.0")
-        parallel <- 1
-    hasClus <- inherits(parallel, "cluster")
+if(is.null(parallel) && getRversion()>="2.15.0")
+   parallel <- get("default", 
+                   envir = parallel:::.reg)
+if (is.null(parallel) || getRversion()<"2.14.0")
+    parallel <- 1
+hasClus <- inherits(parallel, "cluster")
 @ 
 \item Integer: An integer value is taken as the number of created
   parallel processes.  In unix-like systems this is the number of
@@ -261,7 +264,7 @@
 The matrix temperature is intuitively simple
 (Fig. \ref{fig:nestedtemp}), but the the exact calculations were not
 explained in the original publication \cite{AtmarPat93}.
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false,results=hide>>=
 data(sipoo)
 mod <- nestedtemp(sipoo)
@@ -284,7 +287,7 @@
   the fill line. The ``surprise'' for this point is $u = (d/D)^2$ and
   the matrix temperature is based on the sum of surprises: presences
   outside the fill line or absences within the fill line.}
-\end{SCfigure}
+\end{figure}
 The function can be implemented in many ways following the general
 principles.  \citet{RodGir06} have seen the original code and reveal
 more details of calculations, and their explanation is the basis of
@@ -446,7 +449,8 @@
 apply to species scores and constraints or linear combination scores;
 weighted averaging scores have somewhat wider dispersion.
 
-\begin{table}
+\begin{table*}[t]
+  \centering
   \caption{\label{tab:scales} Alternative scalings for \textsc{rda} used
     in the functions \code{prcomp} and \code{princomp}, and the
     one used in the \pkg{vegan} function \code{rda} 
@@ -460,7 +464,8 @@
     is derived
     dividing each  species by its standard deviation $s_j$ (possibly
     with some additional constant multiplier).  }
-\begin{tabular}{lcc}
+ \begin{tabular}{lcc}
+  \\
 & \textbf{Site scores} $u_{ik}^*$ &
 \textbf{Species scores} $v_{jk}^*$ \\
 \code{prcomp, princomp} &
@@ -491,8 +496,10 @@
 % $u_{ik} \sqrt{n-1} \sqrt[4]{\lambda_k / \sum \lambda_k}$ &
 % $v_{jk} \sqrt{n} \sqrt[4]{\lambda_k / \sum \lambda_k}$
 \end{tabular}
-\end{table}
+\end{table*}
 
+
+
 In community ecology, it is common to plot both species and sites in
 the same graph.  If this graph is a graphical display of \textsc{svd},
 or a graphical, low-dimensional approximation of the data, the graph
@@ -539,21 +546,23 @@
 have two separate scaling constants: the first for the species, and
 the second for sites and friends, and this allows getting scores of
 other software or \proglang{R} functions (Table \ref{tab:rdaconst}). 
-\begin{table}
+\begin{table*}[t]
+  \centering
   \caption{\label{tab:rdaconst} Values of the \code{const} argument in
     \textbf{vegan} to get the scores that are equal to those from
     other functions and software. Number of sites (rows) is $n$, 
     the number of species (columns) is $m$, and the sum of all
     eigenvalues is $\sum_k \lambda_k$ (this is saved as the item
     \code{tot.chi} in the \code{rda} result)}.
-\begin{tabular}{lccc}
+ \begin{tabular}{lccc}
+  \\
 & \textbf{Scaling} &\textbf{Species constant} & \textbf{Site constant} \\
 \pkg{vegan} & any  & $\sqrt[4]{(n-1) \sum \lambda_k}$ & $\sqrt[4]{(n-1) \sum \lambda_k}$\\
 \code{prcomp}, \code{princomp} & \code{1} & $1$ & $\sqrt{(n-1) \sum_k \lambda_k}$\\
 \proglang{Canoco\,v3} & \code{-1, -2, -3} & $\sqrt{n-1}$ & $\sqrt{n}$\\
 \proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$
 \end{tabular}
-\end{table}
+\end{table*}
 
 In this chapter, I used always centred data matrices.  In principle
 \textsc{svd} could be done with original, non-centred data, but
@@ -631,13 +640,13 @@
 <<a,fig=false>>=
 plot(orig, dis=c("lc","bp"))
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{LC scores in CCA of the original data.}
 \label{fig:ccalc}
-\end{SCfigure}
+\end{figure}
 
 What would happen to linear combinations of LC scores if we shuffle
 the ordering of sites in species data?  Function \code{sample()} below
@@ -646,26 +655,27 @@
 i <- sample(nrow(varespec))
 shuff <- cca(varespec[i,] ~ Al + K, varechem)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 plot(shuff, dis=c("lc","bp"))
 @
 \caption{LC scores of shuffled species data.}
 \label{fig:ccashuff}
-\end{SCfigure}
+\end{figure}
 It seems that site scores are fairly similar, but oriented differently
 (Fig. \ref{fig:ccashuff}).  We can use Procrustes rotation to see how
 similar the site scores indeed are (Fig. \ref{fig:ccaproc}).
 <<a,fig=false>>=
-plot(procrustes(scores(orig, dis="lc"), scores(shuff, dis="lc")))
+plot(procrustes(scores(orig, dis="lc"), 
+                scores(shuff, dis="lc")))
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{Procrustes rotation of LC scores from CCA of original and shuffled data.}
 \label{fig:ccaproc}
-\end{SCfigure}
+\end{figure}
 There is a small difference, but this will disappear if we use
 Redundancy Analysis (RDA) instead of CCA
 (Fig. \ref{fig:rdaproc}). Here we use a new shuffling as well.
@@ -674,13 +684,14 @@
 i <- sample(nrow(varespec)) # Different shuffling
 tmp2 <- rda(varespec[i,] ~ Al + K, varechem)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
-plot(procrustes(scores(tmp1, dis="lc"), scores(tmp2, dis="lc")))
+plot(procrustes(scores(tmp1, dis="lc"), 
+                scores(tmp2, dis="lc")))
 @
 \caption{Procrustes rotation of LC scores in RDA of the original and shuffled data.}
 \label{fig:rdaproc}
-\end{SCfigure}
+\end{figure}
 
 LC scores indeed are linear combinations of constraints (environmental
 variables) and \emph{independent of species data}: You can
@@ -701,14 +712,14 @@
 @
 Similarly their WA scores will be (probably) very different
 (Fig. \ref{fig:ccawa}).
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 plot(procrustes(orig, shuff))
 @
 \caption{Procrustes rotation of WA scores of CCA with the original and
   shuffled data.}
 \label{fig:ccawa}
-\end{SCfigure}
+\end{figure}
 
 The example used only two environmental variables so that we can
 easily plot all constrained axes.  With a larger number of
@@ -719,7 +730,8 @@
 <<>>=
 tmp1 <- rda(varespec ~ ., varechem)
 tmp2 <- rda(varespec[i,] ~ ., varechem)
-proc <- procrustes(scores(tmp1, dis="lc", choi=1:14), scores(tmp2, dis="lc", choi=1:14))
+proc <- procrustes(scores(tmp1, dis="lc", choi=1:14), 
+                   scores(tmp2, dis="lc", choi=1:14))
 max(residuals(proc))
 @
 In \code{cca} the difference would be somewhat larger than now
@@ -740,14 +752,14 @@
 @
 When the results are plotted using LC scores, sample plots fall only
 in four alternative positions (Fig. \ref{fig:factorlc}).
-\begin{SCfigure}
+\begin{figure}
 <<fig=TRUE,echo=false>>=
 plot(orig, dis="lc")
 @
 \caption{LC scores of the dune meadow data using only one factor as a
   constraint.}
 \label{fig:factorlc}
-\end{SCfigure}
+\end{figure}
 In the previous chapter we saw that this happens because LC scores
 \emph{are} the environmental variables, and they can be distinct only
 if the environmental variables are distinct.  However, normally the user
@@ -765,14 +777,14 @@
 ordispider(orig, col="red")
 text(orig, dis="cn", col="blue")
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=TRUE,echo=false>>=
 <<a>>
 @
 \caption{A ``spider plot'' connecting WA scores to corresponding LC
   scores. The shorter the web segments, the better the ordination.}
 \label{fig:walcspider}
-\end{SCfigure}
+\end{figure}
 This is the standard way of displaying results of discriminant
 analysis, too.  Moisture classes \code{1} and \code{2} seem to be
 overlapping, and cannot be completely separated by their

Modified: pkg/vegan/inst/doc/diversity-vegan.Rnw
===================================================================
--- pkg/vegan/inst/doc/diversity-vegan.Rnw	2013-07-15 19:30:46 UTC (rev 2566)
+++ pkg/vegan/inst/doc/diversity-vegan.Rnw	2013-07-15 19:39:03 UTC (rev 2567)
@@ -1,25 +1,24 @@
 % -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
 %\VignetteIndexEntry{Diversity analysis in vegan}
-\documentclass[a4paper,10pt]{amsart}
+\documentclass[a4paper,10pt,twocolumn]{article}
 \usepackage{vegan} %% vegan setup
 
 \title{Vegan: ecological diversity} \author{Jari Oksanen} 
 
-
-\date{$ $Id$ $
+\date{\footnotesize{$ $Id$ $
   processed with vegan \Sexpr{packageDescription("vegan", field="Version")}
-  in \Sexpr{R.version.string} on \today}
+  in \Sexpr{R.version.string} on \today}}
 
 %% need no \usepackage{Sweave}
 \begin{document}
-\setkeys{Gin}{width=0.55\linewidth}
+\setkeys{Gin}{width=\linewidth}
 \SweaveOpts{strip.white=true}
 <<echo=false>>=
 par(mfrow=c(1,1))
-options(width=72)
+options(width=55)
 figset <- function() par(mar=c(4,4,1,1)+.1)
 options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+  ")
+options("prompt" = "> ", "continue" = "  ")
 @
 
 \maketitle
@@ -117,7 +116,7 @@
 <<echo=false,results=hide>>=
 require(lattice, quietly=TRUE)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 print(plot(R))
 @
@@ -126,7 +125,7 @@
   show the values for sites, and the lines the extremes and median in
   the data set.}
 \label{fig:renyi}
-\end{SCfigure}
+\end{figure}
 
 Finally, the $\alpha$ parameter of Fisher's log-series can be used as
 a diversity index:
@@ -141,23 +140,23 @@
 solve this problem, we may try to rarefy species richness to the same
 number of individuals.  Expected number of species in a community
 rarefied from $N$ to $n$ individuals is:
-\begin{equation}
+\begin{multline}
 \label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\quad \text{where} \quad q_i = {N-x_i
+\hat S_n = \sum_{i=1}^S (1 - q_i),\\ \text{where} \quad q_i = {N-x_i
   \choose n} \Bigm /{N \choose n}
-\end{equation}
+\end{multline}
 where $x_i$ is the count of species $i$, and ${N \choose n}$ is the
 binomial coefficient, or the number of ways we can choose $n$ from
 $N$, and $q_i$ give the probabilities that species $i$ does \emph{not} occur in a
 sample of size $n$.  This is defined only when $N-x_i > n$, but for
 other cases $q_i = 0$ or the species is sure to occur in the sample.
 The variance of rarefied richness is:
-\begin{equation}
+\begin{multline}
 \label{eq:rarevar}
-s^2 = q_i (1-q_i) + 2 \sum_{i=1}^S \sum_{j>i} \left[ {N- x_i - x_j
+s^2 = q_i (1-q_i)  \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ {N- x_i - x_j
     \choose n} \Bigm / {N
     \choose n} - q_i q_j\right]
-\end{equation}
+\end{multline}
 Equation \ref{eq:rarevar} actually is of the same form as the variance
 of sum of correlated variables:
 \begin{equation}
@@ -260,7 +259,7 @@
 taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
 mod <- taxondive(dune, taxdis)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 plot(mod)
 @
@@ -268,7 +267,7 @@
   points are diversity values of single sites, and the funnel is their
   approximate confidence intervals ($2 \times$ standard error).}
 \label{fig:taxondive}
-\end{SCfigure}
+\end{figure}
 
 \subsection{Functional diversity: the height of property tree}
 
@@ -316,14 +315,14 @@
 fish <- fisherfit(BCI[k,])
 fish
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 plot(fish)
 @
 \caption{Fisher's log-series fitted to one randomly selected site
   (\Sexpr{k}).}
 \label{fig:fisher}
-\end{SCfigure}
+\end{figure}
 We already saw $\alpha$ as a diversity index.  Now we also obtained
 estimate of standard error of $\alpha$ (these also are optionally
 available in \code{fisher.alpha}).  The standard errors are based on
@@ -394,14 +393,14 @@
 rad <- radfit(BCI[k,])
 rad
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 print(radlattice(rad))
 @
 \caption{Ranked abundance distribution models for a random plot
   (no. \Sexpr{k}).  The best model has the lowest \textsc{aic}.}
 \label{fig:rad}
-\end{SCfigure}
+\end{figure}
 
 Function \code{radfit} compares the models using alternatively
 Akaike's or Schwartz's Bayesian information criteria.  These are based
@@ -433,18 +432,18 @@
 addition, there are three analytic models.  Rarefaction pools
 individuals together, and applies rarefaction equation (\ref{eq:rare})
 to these individuals.  Kindt's exact accumulator resembles rarefaction:
-\begin{equation}
+\begin{multline}
 \label{eq:kindt}
-\hat S_n = \sum_{i=1}^S (1 - p_i), \, \text{where} \quad p_i = {N- f_i
+\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad  p_i = {N- f_i
 \choose n} \Bigm / {N \choose n}
-\end{equation}
+\end{multline}
 where $f_i$ is the frequency of species $i$.  Approximate variance
 estimator is:
-\begin{equation}
+\begin{multline}
 \label{eq:kindtvar}
-s^2 = p_i (1 - p_i) + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
+s^2 = p_i (1 - p_i)  \\ + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
   \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right)
-\end{equation}
+\end{multline}
 where $r_{ij}$ is the correlation coefficient between species $i$ and
 $j$.  Both of these are unpublished: eq. \ref{eq:kindt} was developed
 by Roeland Kindt, and eq. \ref{eq:kindtvar} by Jari Oksanen. The third
@@ -463,13 +462,13 @@
 sac <- specaccum(BCI)
 plot(sac, ci.type="polygon", ci.col="yellow")
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{Species accumulation curve for the BCI data; exact method.}
 \label{fig:sac}
-\end{SCfigure}
+\end{figure}
 
 \subsection{Beta diversity}
 
@@ -558,7 +557,7 @@
 mod <- with(dune.env, betadisper(z, Management))
 mod
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 boxplot(mod)
 @
@@ -566,7 +565,7 @@
   ($z$) of the species area curve in the Arrhenius model $S = cX^z$ in
   Management classes of dune meadows.}
 \label{fig:betadisper}
-\end{SCfigure}
+\end{figure}
 
 \section{Species pool}
 \subsection{Number of unseen species}
@@ -585,9 +584,9 @@
 the pool size $S_p$:
 \begin{align}
 S_p &= S_o + \frac{f_1^2}{2 f_2} & \text{Chao}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} &
-\text{2nd order Jackknife}\\
+S_p &= S_o + f_1 \frac{N-1}{N}  & \text{1st order Jackknife}\\
+S_p & = S_o + f_1 \frac{2N-3}{N} \nonumber \\ & + f_2 \frac{(N-2)^2}{N(N-1)}
+& \text{2nd order Jackknife}\\
 S_p &= S_o + \sum_{i=1}^{S_o} (1-p_i)^N & \text{Bootstrap}
 \end{align}
 Here $S_o$ is the observed number of species, $f_1$ and $f_2$ are the
@@ -612,12 +611,9 @@
 \code{specpool} (but contributions are welcome).
 For the variance of bootstrap estimator, it is practical to define a
 new variable $q_i = (1-p_i)^N$ for each species:
-\begin{equation}
-\begin{split}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p , \quad \text{where} \\
-Z_p = \dots
-\end{split}
-\end{equation}
+\begin{multline}
+s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p ,\\ \text{where}\; Z_p = \dots
+\end{multline}
 
 The extrapolated richness values for the whole BCI data are:
 <<>>=
@@ -647,7 +643,7 @@
 \begin{equation}
 \begin{split}
 S_p &= S_\mathrm{abund} + \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} +
-\frac{a_1}{C_\mathrm{ACE}} \gamma^2 \quad \text{where}\\
+\frac{a_1}{C_\mathrm{ACE}} \gamma^2\, , \quad \text{where}\\
 C_\mathrm{ACE} &= 1 - \frac{a_1}{N_\mathrm{rare}}\\
 \gamma^2 &= \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} \sum_{i=1}^{10} i
 (i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}
@@ -700,14 +696,16 @@
 the target species in the smoothing (Fig. \ref{fig:beals}):
 <<a>>=
 j <- which(colnames(BCI) == "Ceiba.pentandra")
-plot(beals(BCI, species=j, include=FALSE), BCI[,j], main="Ceiba pentandra", xlab="Probability of occurrence", ylab="Occurrence")
+plot(beals(BCI, species=j, include=FALSE), BCI[,j], 
+     main="Ceiba pentandra", xlab="Probability of occurrence",
+     ylab="Occurrence")
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{Beals smoothing for \emph{Ceiba pentandra}.}
 \label{fig:beals}
-\end{SCfigure}
+\end{figure}
 
 \end{document}

Modified: pkg/vegan/inst/doc/intro-vegan.Rnw
===================================================================
--- pkg/vegan/inst/doc/intro-vegan.Rnw	2013-07-15 19:30:46 UTC (rev 2566)
+++ pkg/vegan/inst/doc/intro-vegan.Rnw	2013-07-15 19:39:03 UTC (rev 2567)
@@ -1,27 +1,30 @@
 % -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
 %\VignetteIndexEntry{Introduction to ordination in vegan}
-\documentclass[a4paper,10pt]{amsart}
+\documentclass[a4paper,10pt]{article}
 \usepackage{vegan} % vegan settings
 
+%% one column and sidecaption figures
+\renewenvironment{figure}[1][tp]{\begin{SCfigure}[][#1]}{\end{SCfigure}}
+
 \title{Vegan: an introduction to ordination} 
 \author{Jari Oksanen}
 
-\date{$ $Id$ $
+\date{\footnotesize{$ $Id$ $
   processed with vegan
 \Sexpr{packageDescription("vegan", field="Version")}
-in \Sexpr{R.version.string} on \today}
+in \Sexpr{R.version.string} on \today}}
 
 %% need no \usepackage{Sweave}
 \begin{document}
 
-\setkeys{Gin}{width=0.55\linewidth}
+\setkeys{Gin}{width=0.55\linewidth} % 0.55 for sidecaption
 \SweaveOpts{strip.white=true}
 <<echo=false>>=
 par(mfrow=c(1,1))
 options(width=72)
 figset <- function() par(mar=c(4,4,1,1)+.1)
 options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+  ")
+options("prompt" = "> ", "continue" = "  ")
 @
 
 \maketitle
@@ -115,13 +118,13 @@
 <<a>>=
 plot(ord)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{Default ordination plot.}
 \label{fig:plot}
-\end{SCfigure}
+\end{figure}
 Default \code{plot} command uses either black circles for sites and
 red pluses for species, or black and red text for sites and species,
 resp.  The choices depend on the number of items in the plot and
@@ -137,14 +140,14 @@
 points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
 text(ord, display = "spec", cex=0.7, col="blue")
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{A more colourful ordination plot where sites are points, and
   species are text.}
 \label{fig:plot.args}
-\end{SCfigure}
+\end{figure}
 
 All \pkg{vegan} ordination methods have a specific \code{plot}
 function.  In addition, \pkg{vegan} has an alternative plotting
@@ -214,14 +217,14 @@
 ordispider(ord, Management, col="red", label = TRUE)
 points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{Convex hull, standard error ellipse and a spider web diagram
   for Management levels in ordination.}
 \label{fig:ordihull}
-\end{SCfigure}
+\end{figure}
 In addition, you can overlay a cluster dendrogram from \code{hclust}
 using \code{ordicluster} or a minimum spanning tree from
 \code{spantree} with its \code{lines} function.  Segmented arrows
@@ -263,7 +266,7 @@
 <<b,fig=false>>=
 ordisurf(ord, A1, add=TRUE)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false,results=hide>>=
 <<a>>
 <<b>>
@@ -271,7 +274,7 @@
 \caption{Fitted vector and smooth surface for the thickness of A1
   horizon (\code{A1}, in cm), and centroids of Management levels.}
 \label{fig:envfit}
-\end{SCfigure}
+\end{figure}
 
 \section{Constrained ordination}
 
@@ -294,13 +297,13 @@
 <<a>>=
 plot(ord)
 @
-\begin{SCfigure}
+\begin{figure}
 <<fig=true,echo=false>>=
 <<a>>
 @
 \caption{Default plot from constrained correspondence analysis.}
 \label{fig:cca}
-\end{SCfigure}
+\end{figure}
 There are three groups of items: sites, species and centroids (and
 biplot arrows) of environmental variables.  All these can be added
 individually to an empty plot, and all previously explained tricks of



More information about the Vegan-commits mailing list