Plot PCA Scores of a Spectra Object

Description

Plots the requested PCA scores using the color scheme derived from a Spectra object. Options are provided to add confidence ellipses for each group in the object. The ellipses may be robust or classical. Option to label the extreme points provided.

Usage

1
2
3
plotScores(spectra, pca, pcs = c(1, 2),
	ellipse = "none", tol = "none",
	use.sym = FALSE, leg.loc = "topright", ...)

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). This is automatically provided if ChemoSpec functions c_pcaSpectra or r_pcaSpectra were used to create pca.

pcs

A vector of two integers specifying the PCA scores to plot.

ellipse

A character vector specifying the type of ellipses to be plotted. One of c("both", "none", "cls", "rob"). cls specifies classical confidence ellipses, rob specifies robust confidence ellipses.

tol

A number describing the fraction of points to be labeled. tol = 1.0 labels all the points; tol = 0.05 labels the most extreme 5 percent.

use.sym

A logical; if true, the color scheme is set to black and the points plotted with symbols.

leg.loc

Character; if "none" no legend will be drawn. Otherwise, any string acceptable to legend.

...

Additional parameters to be passed to the plotting functions.

Value

None. Side effect is a plot.

Author(s)

Bryan A. Hanson, DePauw University. hanson@depauw.edu

References

https://github.com/bryanhanson/ChemoSpec

See Also

For other ways of displaying the results, plotScree, plotLoadings, plot2Loadings. For a 3D plot of the scores, see plotScores3D, or plotScoresRGL for an interactive version.

Examples

1
2
3
4
data(metMUD1)
results <- c_pcaSpectra(metMUD1)
plotScores(metMUD1, results, main = "metMUD1 NMR Data",
	pcs = c(1,2), ellipse = "cls", tol = 0.05)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.