plot_ordination_utils: Plot species loading with ordinations

View source: R/plot_ordination_utils.R

plot_ordination_utilsR Documentation

Plot species loading with ordinations

Description

This function extends the plot_ordination function of phyloseqto highlight the top taxa loadings on the species ordination.

Usage

plot_ordination_utils(
  x,
  ordiObject,
  color.opt = NULL,
  plot.arrow = TRUE,
  scale.arrow = NULL,
  top.taxa = 5
)

Arguments

x

phyloseq-class object

ordiObject

Output of ordinate from package phyloseq. Only NMDS/CCA and Bray supported.

color.opt

Variable of interest from metadata.

plot.arrow

If arrow should be plotted for species either TRUE or FALSE.

scale.arrow

If arrow is plotted a constant to multiply axis values for clearing visualisations.

top.taxa

Top varying taxa to plot, default is 5.

Details

This function is useful for visualizing specifc taxa that could be important in explaining variations in ordinations.

Value

plot

Examples

## Not run: 

library(microbiomeutilities)
library(RColorBrewer)
data("zackular2014")
ps1 <- zackular2014
ps2 <- tax_glom(ps1, "Genus")
ps2f <- format_to_besthit(ps2)
orddi <- ordinate(ps2f, method = "CCA", distance = "bray")
p <- plot_ordination_utils(ps2f, orddi,
  color = "DiseaseState", plot.arrow = TRUE,
  scale.arrow = 1.3, top.taxa = 5
)
print(p)

## End(Not run)

microsud/microbiomeutilities documentation built on Nov. 29, 2022, 12:18 a.m.