Skip to content

Commit

Permalink
plot.cca tells about pipes to configure plots
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Jun 4, 2024
1 parent 6917ea2 commit 2ab9b8f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
33 changes: 20 additions & 13 deletions man/plot.cca.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,21 @@
standard and more easily interpreted, and regression arrows should be
used only if you know that you need them.

If you want to have a better control of plots, it is best to
construct the plot \code{text} and \code{points} commands which
accept graphical parameters. It is important to remember to use the
same \code{scaling}, \code{correlation} and \code{hill} arguments
in all calls. The \code{plot.cca} command returns invisibly an
If you want to have a better control of plots, it is best to construct
the plot \code{text} and \code{points} commands which accept graphical
parameters. It is important to remember to use the same
\code{scaling}, \code{correlation} and \code{hill} arguments in all
calls. The \code{plot.cca} command returns invisibly an
\code{\link{ordiplot}} result object, and this will have consistent
scaling for all its elements. The easiest way for full control of
graphics is to first set up the plot frame using \code{plot} with
\code{type = "n"} and all needed scores in \code{display} and save
this result. The \code{points} and \code{text} commands for
\code{\link{ordiplot}} will allow full graphical control (see
section Examples). Utility function \code{labels} returns the default
labels in the order they are applied in \code{text}.
scaling for all its elements. It is also possible to use \R{} pipes
(\code{|>}) which maintain consistent scaling and setting. The easiest
way for full control of graphics is to first set up the plot frame
using \code{plot} with \code{type = "n"} and all needed scores in
\code{display} and save this result or use it as a first command in a
pipe. The \code{points} and \code{text} commands for
\code{\link{ordiplot}} will allow full graphical control (see section
Examples). Utility function \code{labels} returns the default labels
in the order they are applied in \code{text}.

Palmer (1993) suggested using linear constraints (\dQuote{LC scores})
in ordination diagrams, because these gave better results in
Expand Down Expand Up @@ -209,7 +211,12 @@ pca <- rda(dune)
pl <- plot(pca, type="n", scaling="sites", correlation=TRUE)
with(dune.env, points(pl, "site", pch=21, col=1, bg=Management))
text(pl, "sp", arrow=TRUE, length=0.05, col=4, cex=0.6, xpd=TRUE)
with(dune.env, legend("bottomleft", levels(Management), pch=21, pt.bg=1:4, bty="n"))
with(dune.env, legend("bottomleft", levels(Management), pch=21,
pt.bg=1:4, bty="n"))
## Configuration with pipes: make an arrow biplot
plot(pca, type="n", scaling="sites", correlation=TRUE) |>
points("sites", pch=21, col = 1, cex=1.5, bg = dune.env$Management) |>
text("species", col = "blue", arrow = TRUE, xpd = TRUE)
## Scaling can be numeric or more user-friendly names
## e.g. Hill's scaling for (C)CA
scrs <- scores(mod, scaling = "sites", hill = TRUE)
Expand Down
9 changes: 7 additions & 2 deletions tests/Examples/vegan-Ex.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -6111,7 +6111,12 @@ ungrazed-grazed -0.1219422 -0.2396552 -0.004229243 0.0429502
> pl <- plot(pca, type="n", scaling="sites", correlation=TRUE)
> with(dune.env, points(pl, "site", pch=21, col=1, bg=Management))
> text(pl, "sp", arrow=TRUE, length=0.05, col=4, cex=0.6, xpd=TRUE)
> with(dune.env, legend("bottomleft", levels(Management), pch=21, pt.bg=1:4, bty="n"))
> with(dune.env, legend("bottomleft", levels(Management), pch=21,
+ pt.bg=1:4, bty="n"))
> ## Configuration with pipes: make an arrow biplot
> plot(pca, type="n", scaling="sites", correlation=TRUE) |>
+ points("sites", pch=21, col = 1, cex=1.5, bg = dune.env$Management) |>
+ text("species", col = "blue", arrow = TRUE, xpd = TRUE)
> ## Scaling can be numeric or more user-friendly names
> ## e.g. Hill's scaling for (C)CA
> scrs <- scores(mod, scaling = "sites", hill = TRUE)
Expand Down Expand Up @@ -8948,7 +8953,7 @@ Procrustes sum of squares:
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed: 8.559 0.295 8.885 0 0
Time elapsed: 8.568 0.288 8.883 0 0
> grDevices::dev.off()
null device
1
Expand Down

0 comments on commit 2ab9b8f

Please sign in to comment.