Skip to contents

Draw a lightweight scatter plot from a microbiome_ordination object.

Usage

plot_ordination(
  object,
  x = NULL,
  y = NULL,
  color_by = NULL,
  shape_by = NULL,
  label_samples = FALSE,
  ellipse_by = NULL,
  centroid_by = NULL,
  show_loading = FALSE,
  loading_scale = 1
)

Arguments

object

A microbiome_ordination object.

x

Axis column used for the x-axis.

y

Axis column used for the y-axis.

color_by

Optional column used for point color.

shape_by

Optional column used for point shape.

label_samples

Should sample labels be drawn? Defaults to FALSE.

ellipse_by

Optional grouping column used to draw confidence ellipses.

centroid_by

Optional grouping column used to draw group centroids.

show_loading

Should feature loadings be drawn when available?

loading_scale

Multiplier used to scale feature loading arrows.

Value

A ggplot object.

Examples

data("global_patterns", package = "microbiomedataset")

ord <- run_ordination(global_patterns, method = "PCoA")
p <- plot_ordination(ord, color_by = "SampleType")
class(p)
#> [1] "ggplot2::ggplot" "ggplot"          "ggplot2::gg"     "S7_object"      
#> [5] "gg"