ggbiplot: methods for making biplots from various projection &...

View source: R/ggbiplot.R

ggbiplotR Documentation

methods for making biplots from various projection & classification models

Description

Pretty biplots using ggplots

Usage

ggbiplot(xobj, ...)

## S3 method for class 'princomp'
ggbiplot(xobj, ...)

## S3 method for class 'prcomp'
ggbiplot(xobj, ...)

## S3 method for class 'lda'
ggbiplot(xobj, ...)

## S3 method for class 'plsda'
ggbiplot(xobj, Yplot = FALSE, ...)

## S3 method for class 'splsda'
ggbiplot(xobj, ...)

## S3 method for class 'matrix'
ggbiplot(xobj, ...)

## Default S3 method:
ggbiplot(
  xobj,
  grouping,
  select = 1:2,
  circle = FALSE,
  circle.prob = 0.69,
  plot.loadings = TRUE,
  label.loadings = FALSE,
  sub.loadings = 1:nrow(xobj$loadings),
  label.offset = 0,
  label.size = 4.5,
  scale.loadings = 1,
  col.loadings = scales::muted("red"),
  alpha = 1,
  col = grouping,
  shape = NULL,
  group.ellipse = FALSE,
  scale.ellipse = 1,
  group.cloud = FALSE,
  xlab = "",
  ylab = "",
  equalcoord = TRUE,
  size = 3,
  size.loadings = 1,
  loadingsOnTop = FALSE
)

Arguments

xobj

The object to be plotted

grouping

an optional grouping vector (ie - for coloring points)

select

index of components to be plotted (must be length 2)

circle

enclose points in a circle

circle.prob

controls circle diameter (scales data std dev) if circle = TRUE

plot.loadings

should loading vectors be plotted

label.loadings

text of loadings labels, taken from rownames of loadings (depends on class of xobj)

label.offset

absolute offset for loading labels, so labels don't cover loadings vectors

scale.loadings

scale length of loading vectors for plotting purposes

col.loadings

a single value of vector for color of loadings

alpha

controls relative transparency of various plot features

col

color factor for points

group.ellipse

enclose within-group points in an covariance ellipse

scale.ellipse

scale group.ellipse to 1 standard deviation

group.cloud

connect within-group points to a group mean point with a straight edge

xlab

label for x axis

ylab

label for y axis

equalcoord

equal coordinates, ie should the plot area be square?

size

point size

size.loadings

line width of loading vectors

Details

additional plotting attributes (eg colors, themes, etc) can be chained on in the usual way for ggplots

Examples

 # an LDA example with iris data
ldamod <- lda(iris[,1:4], grouping=iris[,5])
ggbiplot(ldamod, grouping=iris[,5], alpha=.7, group.cloud=TRUE) + theme_bw()

zdk123/compPLS documentation built on April 24, 2022, 2:44 p.m.