Learn R Programming

ChemoSpec (version 3.0-1)

plotScores3D: 3D PCA Score Plot for a Spectra Object

Description

Creates a basic 3D plot of PCA scores from the analysis of a "Spectra" object, color coded according the to scheme stored in the object.

Usage

plotScores3D(spectra, pca, pcs = c(1:3),
	ellipse = TRUE, rob = FALSE,
	cl = 0.95, frac.pts.used = 0.80,
	view = list(y = 34, x = 10, z = 0),
	tol = 0.01, use.sym = FALSE, ...)

Arguments

spectra
An object of S3 class "Spectra".
pca
An object of class prcomp, modified to include a list element called $method, a character string describing the pre-processing carried out and the type of PCA performed (it appears on the plot).
pcs
A vector of three integers specifying the PCA scores to plot.
ellipse
Logical indicating if confidence ellipses should be drawn.
rob
Logical; if ellipse = TRUE, indicates that robust confidence ellipses should be drawn. If FALSE, classical confidence ellipses are drawn.
cl
A number indicating the confidence interval for the ellipse.
frac.pts.used
If ellipse = TRUE and rob = TRUE, a number indicating the fraction of the data points to be considered "good" and thus used to compute the robust confidence ellipse.
view
A list of viewing transformations to be applied to the data. May contain values for x, y and z axes; keep in mind that the order of the transformations is important. For example, specifying view = list(x = 45, y = 10) produces a different v
tol
Quantile to be used to label extreme data points. Currently not used - need to fix the code!
use.sym
logical; if true, the color scheme is change to black and symbols are used for plotting.
...
Other parameters to be passed downstream.

Value

  • None. Side effect is a plot.

References

https://github.com/bryanhanson/ChemoSpec

See Also

For a 2D plot of the scores, see plotScores. For more sophisticated 3D plots, use plotScoresRGL.

Examples

Run this code
data(CuticleIR)
results <- classPCA(CuticleIR, choice = "noscale")
plotScores3D(CuticleIR, results, main = "Cuticle IR Spectra")

Run the code above in your browser using DataLab