geom_arrow_pca: Arrow for PCA bi-plot

View source: R/pca.R

geom_arrow_pcaR Documentation

Arrow for PCA bi-plot

Description

Arrow for PCA bi-plot

Usage

geom_arrow_pca(
  pca_recipe,
  x = PC1,
  y = PC2,
  x_origin = 0,
  y_origin = 0,
  length = ggplot2::unit(0.05, "inches"),
  type = "closed",
  color = "black",
  ...
)

Arguments

pca_recipe

Object class recipe that already step_pca

x

unquoted name to specify which principle component to plot in x-axis (must be one of PC1, PC2, PC3, ... ,etc.)

y

unquoted name to specify which principle component to plot in y-axis (must be one of PC1, PC2, PC3, ... ,etc.)

x_origin

(numeric) x-origin of the arrow

y_origin

(numeric) y-origin of the arrow

length

length of the arrow defined by function ggplot2::unit (passed to ggplot2::arrow)

type

type of the arrow head (passed to ggplot2::arrow)

color

color of the arrow segment (passed to ggplot2::geom_segment)

...

passed to geom_segment

Value

plot arrow

Examples

library(magrittr)
library(lbmod)
prep_pca(iris) %>%
  pca_scatter_plot(ggplot2::aes(color = Species)) +
  geom_arrow_pca(prep_pca(iris))

Lightbridge-KS/lbmod documentation built on Jan. 28, 2024, 6:21 p.m.