pca_score_plot: pca_score_plot

View source: R/pca_analysis.R

pca_score_plotR Documentation

pca_score_plot

Description

pca_score_plot

Usage

pca_score_plot(
  object,
  pca_object,
  x = 1,
  y = 2,
  color_by,
  point_alpha = 1,
  point_size = 5,
  point_shape = 21,
  frame = TRUE,
  frame.type = "norm",
  ...
)

Arguments

object

mass_dataset.

pca_object

pca_object from run_pca()

x

PC x for X axis, default is 1.

y

PC y for Y axis, default is 2.

color_by

which column (sample_info) is used to color samples

point_alpha

point_alpha default is 1.

point_size

point_size, default is 5.

point_shape

point_shape default is 21.

frame

?ggplot2::autoplot

frame.type

?ggplot2::autoplot

...

other paramters for ggplot2::autoplot

Value

ggplot2 plot.

Author(s)

Xiaotao Shen shenxt1990@163.com

Examples

library(massdataset)
library(magrittr)
library(dplyr)
data("liver_aging_pos")
liver_aging_pos

pca_object =
  liver_aging_pos %>%
  scale() %>%
  run_pca()

pca_score_plot(liver_aging_pos,
               pca_object,
               color_by = "group",
               loadings = TRUE)

pca_score_plot(liver_aging_pos,
               pca_object,
               color_by = "group",
               frame = TRUE) +
  ggrepel::geom_text_repel(aes(label = sample_id))

pca_score_plot(liver_aging_pos,
               pca_object,
               x = 1,
               y = 3,
               color_by = "group",
               frame = TRUE) +
  ggrepel::geom_text_repel(aes(label = sample_id))

tidymass/massstat documentation built on March 12, 2024, 6:24 a.m.