Plot principal component loadings

Description

Plot principal component loadings.

Usage

1
2
3
4
plotld(x, npc=3, main="Loadings", lty=1, lwd=4 / 1:npc,
    col=gray(0:(npc-1) / npc), ylim=range(loadings), abs.=FALSE,
    cex=.8, ylab=if(abs.) "abs(loading)" else "loading",
    legend.x=NULL, legend.y=NULL)

Arguments

x

A matrix or dataframe, passed directly to princomp.

npc

Number of principal components to plot. Default 3.

main

Plot title. Default "Loadings".

lty

Line type for for plotted lines. Default 1.

lwd

Line width of plotted lines. The default is ugly but effective: 4 / 1:npc.

col

Color of plotted lines. Default is a range of grays: gray(0:(npc-1) / npc).

ylim

Vertical limits of the graph. Default range(loadings).

abs.

Use absolute values of loadings. Default FALSE.

cex

Character expansion for axis and legend text. Default .8.

ylab

Default "loading".

legend.x, legend.y

Position of the legend. Default NULL, meaning automatic. For no legend, use an out-of-range legend.x or legend.y.

See Also

princomp, plotpc

Examples

1
2
3
data(iris)
x <- iris[, -5] # -5 to drop Species
plotld(x)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.