Learn R Programming

plot.matrix (version 1.6.2)

plot.loadings: plot.loadings

Description

Visualizes the loadings matrix from a Factor Analysis or a Principal Component Analysis matrix with a gray or colored heatmap. As a rule of thumb the breaks are determined by c(-1, -0.866, -0.707, -0.5, -0.4, 0, +0.4, +0.5, +0.707, +0.866, +1) is used. You may need to modify mar with the par command from its default c(5.1,4.1,4.1,2.1). See

  • vignette('plot.matrix') for detailed examples, and

  • plot.matrix for further parameters.

Usage

# S3 method for loadings
plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)

Arguments

x

matrix: loadings

reorder

logical: if the rows (variables) of the loading matrix should be reordered (default: TRUE)

gray

logical: should be a gray scale color palette used or not (default: FALSE)

grey

logical: should be a gray scale color palette used or not (default: FALSE)

...

further parameter given to the plot.matrix command

Value

a plot

Details

If either the parameter grey or gray is TRUE then a gray color palette is used.

Examples

Run this code
# NOT RUN {
data(bfi.2)
library("psych")
par(mar=c(5.1, 4.1, 4.1, 4.1))
# Factor analysis
fa <- factanal(bfi.2, 5)
plot(loadings(fa))
plot(loadings(fa), grey=TRUE)
# Principal Component Analysis I
pa <- princomp(bfi.2)
plot(loadings(pa), digits=NA)
# Principal Component Analysis II
pa <- prcomp(bfi.2)
ld <- structure(pa$rotation, class="loadings") 
plot(ld, digits=NA)
# }

Run the code above in your browser using DataLab