Learn R Programming

swfscMisc (version 1.7.6)

ggBiplot: ggBiplot

Description

Create a biplot of a Principal Components Analysis using ggplot2.

Usage

ggBiplot(
  pca,
  pcs = c(1, 2),
  mult.fac = 0.8,
  arrow.size = NULL,
  label.size = 3,
  plot = TRUE
)

Value

the ggplot2 object is invisibly returned.

Arguments

pca

result from a call to princomp or prcomp.

pcs

a two element vector giving the number or column names of the components to plot.

mult.fac

multiplier factor for positions of points relative to extent of plot (0:1).

arrow.size

thickness of arrow lines. If NULL no arrows are shown.

label.size

size of labels.

plot

show the plot?

Author

Eric Archer [email protected]

Examples

Run this code
pca.princomp <- princomp(USArrests, cor = TRUE)
ggBiplot(pca.princomp)

pca.prcomp <- prcomp(USArrests, cor = TRUE)
ggBiplot(pca.prcomp)

Run the code above in your browser using DataLab