plot_ordination_pq: A wrapper of plot_ordination with vegan distance matrix

plot_ordination_pqR Documentation

A wrapper of plot_ordination with vegan distance matrix

Description

A wrapper of plot_ordination with vegan distance matrix

Usage

plot_ordination_pq(
  physeq,
  method = "robust.aitchison",
  ordination_method = "NMDS",
  add_envfit = FALSE,
  envfit_fact = NULL,
  envfit_pval = 1,
  envfit_arrow_mult = 1,
  envfit_text_size = 3,
  envfit_col = "black",
  ...
)

Arguments

physeq

(required) a phyloseq-class object obtained using the phyloseq package.

method

(string, default "robust.aitchison") The distance method to use from vegan::vegdist(). See ?vegan::vegdist for more details.

ordination_method

(string, default "NMDS") The ordination method to use in phyloseq::ordinate(). See ?phyloseq::ordinate for more details.

add_envfit

(logical, default FALSE) If TRUE, overlay environmental vectors (and factor centroids) fitted to the ordination using vegan::envfit(). Continuous variables are shown as arrows and factor variables as labelled centroids.

envfit_fact

(default NULL) A character vector of variable names from physeq@sam_data to fit onto the ordination. When NULL (default) and add_envfit = TRUE, every variable of physeq@sam_data is used; passing an explicit subset is recommended, as fitting identifier or high-cardinality character columns produces a cluttered overlay.

envfit_pval

(float, default 1) Only environmental variables with an vegan::envfit() p-value lower than or equal to this threshold are drawn. The default (1) draws all of them.

envfit_arrow_mult

(float, default 1) A multiplier applied to the environmental arrow lengths, to scale them for readability.

envfit_text_size

(float, default 3) Text size for the environmental variable labels.

envfit_col

(default "black") Color of the environmental arrows, centroids and labels.

...

Additional arguments passed on to phyloseq::plot_ordination()

Details

lifecycle-stable

Basically a wrapper of phyloseq::plot_ordination() to use aitchison and robust.aitchison distances from vegan package.

Value

A ggplot2 object

Author(s)

Adrien Taudière

See Also

vegan::envfit(), phyloseq::plot_ordination()

Examples

library(patchwork)
plot_ordination_pq(data_fungi_mini, method = "robust.aitchison", color = "Height") +
  plot_ordination_pq(data_fungi_mini, method = "bray", color = "Height")

MiscMetabar documentation built on Nov. 16, 2026, 5:06 p.m.