Description Usage Arguments Value Author(s) See Also Examples
View source: R/plot2Loadings.R
Plots two PCA loadings specified by the user, and labels selected (extreme) points. Typically used to determine which variables (frequencies) are covarying, although in spectroscopy most peaks are represented by several variables and hence there is a lot of covarying going on. Also useful to determine which variables are contributing the most to the clustering on a score plot.
1  plot2Loadings(spectra, pca, loads = c(1, 2), tol = 0.05, ...)

spectra 
An object of S3 class 
pca 
An object of class 
loads 
A vector of two integers specifying which loading vectors to plot. 
tol 
A number describing the fraction of points to be labeled.

... 
Parameters to be passed to the plotting routines. Applies to base graphics only. 
The returned value depends on the graphics option selected (see GraphicsOptions
).
None. Side effect is a plot.
The plot is displayed, and a ggplot2
plot object is returned if the
value is assigned. The plot can be modified in the usual ggplot2
manner.
Bryan A. Hanson (DePauw University), Tejasvi Gupta.
See plotLoadings
to plot one loading against the
original variable (frequency) axis. See sPlotSpectra
for
a different approach. Additional documentation at
https://bryanhanson.github.io/ChemoSpec/
1 2 3 4 5 6 7 8  # This example assumes the graphics output is set to ggplot2 (see ?GraphicsOptions).
library("ggplot2")
data(SrE.IR)
pca < c_pcaSpectra(SrE.IR)
myt < expression(bolditalic(Serenoa) ~ bolditalic(repens) ~ bold(IR ~ Spectra))
p < res < plot2Loadings(SrE.IR, pca, loads = c(1, 2), tol = 0.001)
p < p + ggtitle(myt)
p

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.