plotScree {ChemoSpecUtils} | R Documentation |
Scree Plots from PCA or MIA Analysis of a Spectra or Spectra2D Object
Description
Functions that draw a traditional scree plot, or an alternative style that is perhaps more informative. These plots illustrate the variance explained by each component in a PCA or MIA analysis.
Usage
plotScree(pca, style = "alt", ...)
Arguments
pca |
Either:
|
style |
Character. One of |
... |
Parameters to be passed to the plotting routines. Applies to base graphics only. |
Value
The returned value depends on the graphics option selected (see GraphicsOptions()
).
-
base
: None. Side effect is a plot. -
ggplot2
: The plot is displayed, and aggplot2
object is returned if the value is assigned. The plot can be modified in the usualggplot2
manner.
Author(s)
Bryan A. Hanson (DePauw University), Tejasvi Gupta.
References
The idea for the alternative style plot came from the NIR-Quimiometria blog by jrcuesta, at https://nir-quimiometria.blogspot.com/2012/02/pca-for-nir-spectrapart-004-projections.html
Examples
if (checkForPackageWithVersion("ChemoSpec", 6.0)) {
library("ChemoSpec")
data(metMUD1)
pca <- c_pcaSpectra(metMUD1)
p1 <- plotScree(pca, style = "trad")
p1
p2 <- plotScree(pca, style = "alt")
p2
}
if (checkForPackageWithVersion("ChemoSpec2D", 0.5)) {
library("ChemoSpec2D")
data(MUD1)
mia <- miaSpectra2D(MUD1)
plotScree(mia, style = "alt")
}