Skip to contents

Labels the foods furthest from the origin in each group using ggrepel.

Usage

plot_pca(
  pca_result,
  pc_x = 1L,
  pc_y = 2L,
  n_label = 2L,
  label_fn = .short_label,
  title = NULL
)

Arguments

pca_result

List from run_pca().

pc_x, pc_y

PC axes to plot (default 1 and 2).

n_label

Foods per group to label (default 2).

label_fn

Function to shorten food names.

title

Plot title.

Value

A ggplot2 object.

Examples

pca <- run_pca("amino_acids")
plot_pca(pca)
#> Warning: Removed 3 rows containing missing values or values outside the scale range
#> (`geom_label_repel()`).