Skip to content

Commit

Permalink
ordipointlabel: better and faster example
Browse files Browse the repository at this point in the history
Optimization times grows very rapidly with the number of entries,
and switching from mite (70 x 35) to dune (20 x 30) made example
>1 sec faster in Mac M1. Example also shows now optimization with
three sets of scores ('display').
  • Loading branch information
jarioksa committed Aug 3, 2024
1 parent bfbbc48 commit 50bc791
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
13 changes: 7 additions & 6 deletions man/ordipointlabel.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,16 @@ ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
\author{ Jari Oksanen }

\examples{
data(mite, mite.env)
ord <- cca(mite)
data(dune, dune.env)
ord <- cca(dune)
ordipointlabel(ord)

## Use in a pipe
ord <- cca(mite ~ SubsDens + WatrCont, mite.env)
## Use in a pipe: optimize species, sites & centroids together
ord <- cca(dune ~ Management + Moisture, dune.env)
plot(ord, scaling = "symmetric", type = "n") |>
ordipointlabel() |> # both sites and species
text("biplot", bg = "white", cex=1)
ordipointlabel(c("sites","species","centroids"), cex=c(0.7,0.7,1),
col = c("black","red","blue"), font = c(1,3,1), pch=c(1,3,4), xpd=TRUE) |>
text("biplot", col = "blue", bg = "white", cex=1)
}
\keyword{ hplot }
\keyword{ aplot }
15 changes: 8 additions & 7 deletions tests/Examples/vegan-Ex.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -5218,15 +5218,16 @@ Area 1.4559842 1.3806668 2.73667419 1.5559135
>
> ### ** Examples
>
> data(mite, mite.env)
> ord <- cca(mite)
> data(dune, dune.env)
> ord <- cca(dune)
> ordipointlabel(ord)
>
> ## Use in a pipe
> ord <- cca(mite ~ SubsDens + WatrCont, mite.env)
> ## Use in a pipe: optimize species, sites & centroids together
> ord <- cca(dune ~ Management + Moisture, dune.env)
> plot(ord, scaling = "symmetric", type = "n") |>
+ ordipointlabel() |> # both sites and species
+ text("biplot", bg = "white", cex=1)
+ ordipointlabel(c("sites","species","centroids"), cex=c(0.7,0.7,1),
+ col = c("black","red","blue"), font = c(1,3,1), pch=c(1,3,4), xpd=TRUE) |>
+ text("biplot", col = "blue", bg = "white", cex=1)
>
>
>
Expand Down Expand Up @@ -8989,7 +8990,7 @@ Procrustes sum of squares:
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed: 10.033 0.41 10.476 0 0
Time elapsed: 8.802 0.304 9.136 0 0
> grDevices::dev.off()
null device
1
Expand Down

0 comments on commit 50bc791

Please sign in to comment.