Skip to content

Commit

Permalink
Merge branch 'plot-names'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Jul 3, 2023
2 parents 3efccb1 + dbf4652 commit 3cfbbe4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 16 additions & 4 deletions R/ordiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,22 @@
localPoints(Y, pch = "+", col = "red", cex = cex, ...)
}
if (type == "text") {
if (!is.null(X))
localText(X, labels = rownames(X), col = 1, cex = cex, ...)
if (!is.null(Y))
localText(Y, labels = rownames(Y), col = "red", cex = cex, ...)
if (!is.null(X)) {
labs <- rownames(X)
if (is.null(labs)) {
warning("type='t', but no names available: using x1...")
labs <- paste0("x", as.character(seq_len(nrow(X))))
}
localText(X, labels = labs, col = 1, cex = cex, ...)
}
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", cex = cex, ...)
}
}
out <- list(sites = X, species = Y)
}
Expand Down
2 changes: 2 additions & 0 deletions R/print.wcmdscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
choices <- choices[choices <= NCOL(x$points)]
x$points[, choices, drop = FALSE]
}
if (is.null(rownames(p)))
rownames(p) <- as.character(seq_len(nrow(p)))
if (tidy) {
p <- data.frame(p, "scores" = "sites", "label" = rownames(p),
"weight" = weights(x))
Expand Down

0 comments on commit 3cfbbe4

Please sign in to comment.