plotScores: Plot PCA Scores of a Spectra Object

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/plotScores.R

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
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. An ellipse is drawn for each group in spectra$groups.

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.

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)
pca <- c_pcaSpectra(metMUD1)
plotScores(metMUD1, pca, main = "metMUD1 NMR Data",
	 pcs = c(1,2), ellipse = "cls", tol = 0.05)

ChemoSpec documentation built on Dec. 13, 2017, 1:07 a.m.