pca_plot: 'Clean' looking PCA plotting function using ggplot2

pca_plotR Documentation

'Clean' looking PCA plotting function using ggplot2

Description

'Clean' looking PCA plotting function using ggplot2

Usage

pca_plot(
  data,
  cols,
  color = NA,
  shape = NA,
  label = NA,
  scale = T,
  var_scaling = 5,
  text_size = 8,
  legend_position = "top",
  font_family = "serif",
  axis_alpha = 0.5,
  geom_type = "text",
  point_size = 4,
  repel_variables = F,
  repel_samples = F,
  point_outline = F
)

Arguments

data

Input dataset.

cols

Selection of columns from input dataset to perform the PCA on. These must all be

color

Optional. Select a column for color aesthetic mapping.

shape

Optional. Select a column for shape aesthetic mapping.

label

Optional. Select a column for sample label aesthetic mapping.

scale

Boolean. If TRUE, then correlation PCA. if FALSE, then covariance PCA.

var_scaling

Multiplier for raw variable loadings. Helps scale them to similar values as sample loadings most of the time.

text_size

Font size of all printed labels in points.

legend_position

Legend position. Accepts the same input as legend.position in ggplot's theme function

font_family

Font family to use for all labels.

axis_alpha

Alpha of the plotting x and y axes.

geom_type

Either "text" or "label" to use either geom_text or geom_label, respectively.

point_size

Point size in mm of plotted points.

repel_variables

Boolean. Should plotted variables be repelled?

repel_samples

Boolean. Should plotted samples be repelled?

point_outline

Boolean. Should sample points have a black border?


JackAHutchings/jahrfun documentation built on June 8, 2025, 3:09 a.m.