Skip to content

Commit

Permalink
Merge branch 'ordiplot-use-ordiplot'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Aug 7, 2024
2 parents 2a37aa8 + 412eacc commit 8a1e228
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/identify.ordiplot.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
`identify.ordiplot` <-
function (x, what, labels, ...)
{
x <- scores(x, what)
x <- scores(x, display = what)
if (missing(labels))
labels <- rownames(x)
identify(x, labels = labels, ...)
Expand Down
17 changes: 11 additions & 6 deletions R/ordiplot.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
`ordiplot` <-
function (ord, choices = c(1, 2), type = "points", display, xlim,
ylim, ...)
function (ord, choices = c(1, 2), type = "points", display,
optimize = FALSE, arrows = FALSE, length = 0.05, arr.mul,
xlim, ylim, ...)
{
## local functions to absorb non-par arguments of plot.default
localPoints <- function(..., log, frame.plot, panel.first,
panel.last, axes) points(...)
panel.last, axes) points.ordiplot(...)
localText <- function(..., log, frame.plot, panel.first,
panel.last, axes) text(...)
panel.last, axes) text.ordiplot(...)
if (inherits(ord, "decorana") || inherits(ord, "cca")) {
if (missing(display))
out <- plot(ord, choices = choices, type = type, xlim = xlim,
Expand Down Expand Up @@ -75,15 +76,19 @@
warning("type='t', but no names available: using x1...")
labs <- paste0("x", as.character(seq_len(nrow(X))))
}
localText(X, labels = labs, col = 1, ...)
localText(X, what = "sites", labels = labs, col = 1,
optimize = optimize, arrows = arrows, length = length,
arr.mul = arr.mul, ...)
}
if (!is.null(Y)) {
labs <- rownames(Y)
if (is.null(labs)) {
warning("type='t', but no names available: using y1...")
labs <- paste0("y", as.character(seq_len(nrow(Y))))
}
localText(Y, labels = labs, col = "red", ...)
localText(Y, what = "species", labels = labs, col = "red",
optimize = optimize, arrows = arrows, length = length,
arr.mul = arr.mul, ...)
}
}
out <- list(sites = X, species = Y)
Expand Down
4 changes: 2 additions & 2 deletions R/plot.isomap.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
`plot.isomap` <-
function (x, net = TRUE, n.col = "gray", type = "points", ...)
function (x, net = TRUE, n.col = "gray", type = "points", ...)
{
type <- match.arg(type, c("points", "text", "none"))
if (!net) {
pl <- ordiplot(x, display="sites", type = type, ...)
} else {
pl <- ordiplot(x, display = "sites", type = "none", ...)
z <- scores(pl, "sites")
z <- scores(pl, display = "sites")
k <- x$net
## recycle colour for points
n.col <- rep(n.col, length = nrow(z))
Expand Down
2 changes: 1 addition & 1 deletion R/points.ordiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function (x, what, select, arrows = FALSE, length = 0.05,
arr.mul, ...)
{
sco <- scores(x, what)
sco <- scores(x, display = what)
if (!missing(select))
sco <- .checkSelect(select, sco)
if (!missing(arr.mul)) {
Expand Down
2 changes: 1 addition & 1 deletion R/text.ordiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function (x, what, labels, select, optimize = FALSE, arrows = FALSE,
length = 0.05, arr.mul, bg, ...)
{
sco <- scores(x, what)
sco <- scores(x, display = what)
if (!missing(labels))
rownames(sco) <- labels
if (!missing(select))
Expand Down
3 changes: 2 additions & 1 deletion man/ordiplot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
by layers. }

\usage{
ordiplot(ord, choices = c(1, 2), type="points", display, xlim, ylim, ...)
ordiplot(ord, choices = c(1, 2), type="points", display, optimize = FALSE,
arrows = FALSE, length = 0.05, arr.mul, xlim, ylim, ...)
\method{points}{ordiplot}(x, what, select, arrows = FALSE,
length = 0.05, arr.mul, ...)
\method{text}{ordiplot}(x, what, labels, select, optimize = FALSE,
Expand Down

0 comments on commit 8a1e228

Please sign in to comment.