plotScree | R Documentation |
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.
plotScree(pca, style = "alt", ...)
pca |
Either:
|
style |
Character. One of |
... |
Parameters to be passed to the plotting routines. Applies to base graphics only. |
The returned value depends on the graphics option selected (see GraphicsOptions()
).
base
: None. Side effect is a plot.
ggplot2
: The plot is displayed, and a ggplot2
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.
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
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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.