pcaplot: Plot a PCA object returned by prcomp

View source: R/visualizations.R

pcaplotR Documentation

Plot a PCA object returned by prcomp

Description

Plot a PCA object returned by prcomp

Usage

pcaplot(
  pca,
  components = 1:2,
  group = NULL,
  col = NULL,
  pch = 19,
  cex = 2,
  legend = NULL,
  ...
)

Arguments

pca

PCA object returned by prcomp

components

a vector of length two indicating the components to plot

group

a factor determining shapes of the points to show (unless overriden by pch=...)

col

Color for plotting (default: internal palette)

pch

Type of character to plot (default: 19)

cex

size of the symbols used for plotting

legend

draw a legend? If legend is a position (eg. "topright"), then a legend is drawn. If NULL or if the group parameter is NULL, then not.

...

any further parameters will be passed to the plot() function (e.g. col, cex, ...)

Details

This is a simplistic function. A much better way is to use the pca2d function from the pca3d package.

Value

If group is NULL, then NULL; else a data frame containing colors and shapes matching each group


tmod documentation built on March 31, 2023, 9 p.m.