View source: R/8.barrel_label_axes.R
| barrel_label_axes | R Documentation |
This function creates properly formatted axis titles for ordination plots. It uses the ordination method name (e.g., RDA, dbRDA, NMDS) and, when available, the percentage of variance explained by the first two axes.
barrel_label_axes(ord)
ord |
A vegan ordination object, such as from |
The labels are retrieved using get_ord_axis_labels and
returned as a ggplot2::labs() object that can be added to a plot.
A ggplot2::labs() object with x and y axis titles.
get_ord_axis_labels
library(vegan)
library(ggplot2)
data(dune)
data(dune.env)
# Example with RDA
ord <- rda(dune)
scores_df <- as.data.frame(scores(ord, display = "sites"))
scores_df$Management <- dune.env$Management
ggplot(scores_df, aes(x = PC1, y = PC2, color = Management)) +
geom_point() +
barrel_label_axes(ord) +
theme_minimal() +
theme(axis.title = element_text(face = "bold", size = 13))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.