Learn R Programming

Hmisc (version 5.2-1)

plot.princmp: plot.princmp

Description

Plot Method for princmp

Usage

# S3 method for princmp
plot(
  x,
  which = c("scree", "loadings"),
  k = x$k,
  offset = 0.8,
  col = 1,
  adj = 0,
  ylim = NULL,
  add = FALSE,
  abbrev = 25,
  nrow = NULL,
  ...
)

Value

`ggplot2` object if `which='loadings'`

Arguments

x

results of `princmp`

which

'`scree`' or '`loadings'`

k

number of components to show, default is `k` specified to `princmp`

offset

controls positioning of text labels for cumulative fraction of variance explained

col

color of plotted text in scree plot

adj

angle for plotting text in scree plot

ylim

y-axis scree plotting limits, a 2-vector

add

set to `TRUE` to add a line to an existing scree plot without drawing axes

abbrev

an integer specifying the variable name length above which names are passed through [abbreviate(..., minlength=abbrev)]

nrow

number of rows to use in plotting loadings. Defaults to the `ggplot2` `facet_wrap` default.

...

unused

Author

Frank Harrell

Details

Uses base graphics to by default plot the scree plot from a [princmp()] result, showing cumultive proportion of variance explained. Alternatively the standardized PC loadings are shown in a `ggplot2` bar chart.