Learn R Programming

barrel: Ordination visualization in R

barrel

A tidy and flexible framework for visualizing multivariate ordinations in R


Overview

barrel is an R package that enhances the visualization of ordination analyses (e.g. NMDS, RDA, dbRDA) using ggplot2. It provides a modular set of tools to add ellipses, centroids, environmental vectors, and annotations — all compatible with tidyverse workflows.


Installation

From CRAN:

install.packages("barrel")

Development version from GitHub:

# install.packages("devtools")
devtools::install_github("BarrancoElena/barrel")

Quick example

library(vegan)
library(barrel)
library(ggplot2)

data(dune)
data(dune.env)

ord <- metaMDS(dune)
ord <- barrel_prepare(ord, dune.env)

autoplot(ord, group = "Management", data = dune)

# barrel

Key features

  • autoplot(): single-function plotting of NMDS, RDA, dbRDA, CCA, etc.
  • Support for method = "classic" and "robust" covariance estimation
  • Ellipses (stat_barrel()), centroids (stat_barrel_centroid()), vectors (stat_barrel_arrows())
  • Annotated variance or stress via stat_barrel_annotate()
  • Functions to extract group summaries and environmental fits
  • Customizable with standard ggplot2 syntax

Vignette

A full user guide is available:

browseVignettes("barrel")

Dependencies

Author

Diego Barranco-Elena
@BarrancoElena


License

MIT © 2025 Diego Barranco-Elena

Copy Link

Version

Install

install.packages('barrel')

Version

0.1.0

License

MIT + file LICENSE

Maintainer

Diego Barranco-Elena

Last Published

November 3rd, 2025

Functions in barrel (0.1.0)

barrel_label_axes

Add Axis Titles with Method Name and Explained Variance
ord_ellipse_group

Compute Ellipse Coordinates for a Single Group
barrel_stats

Comprehensive Ordination Visualization Layer
ord_ellipse_groups

Compute Ellipse Coordinates for All Groups
ord_compute_ellipse

Compute coordinates for an ordination ellipse
autoplot.barrel_ord

Autoplot method for barrel_ord objects
barrel_prepare

Prepare ordination object for barrel plotting
barrel_ord_summary

Summary Statistics for Ordination Objects
get_ord_axis_labels

Internal function to get axis labels for vegan ordination objects
ord_extract_centroids

Extract Group Centroids from Ordination Scores
ord_vectors

Extract significant environmental vectors from vegan ordination object
ord_extract_cov

Extract covariance matrix from ordination scores with optional robust estimation