This function extends the plot_ordination function of phyloseq
to highlight the top taxa loadings
on the species ordination.
plot_ordination_utils(
x,
ordiObject,
color.opt = NULL,
plot.arrow = TRUE,
scale.arrow = NULL,
top.taxa = 5
)
phyloseq-class
object
Output of ordinate from package phyloseq. Only NMDS/CCA and Bray supported.
Variable of interest from metadata.
If arrow should be plotted for species either TRUE or FALSE.
If arrow is plotted a constant to multiply axis values for clearing visualisations.
Top varying taxa to plot, default is 5.
plot
This function is useful for visualizing specifc taxa that could be important in explaining variations in ordinations.
if (FALSE) {
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)
}