plotLoadings2D {ChemoSpec2D}R Documentation

Plot Loadings from a PARAFAC, MIA or POP Analysis of a Spectra2D Object

Description

Computes (if necessary) and plots loadings from a PARAFAC, MIA or POP analysis of a Spectra2D object. The loadings matrix has has dimensions F1 x F2 and is a 2D pseudo-spectrum. A reference spectrum may also be drawn.

Usage

plotLoadings2D(
  spectra,
  so,
  load = 1,
  ref = NULL,
  load_lvls = NULL,
  ref_lvls = NULL,
  load_cols = NULL,
  ref_cols = NULL,
  plot = TRUE,
  ...
)

Arguments

spectra

An object of S3 class Spectra2D.

so

("Score Object") One of the following:

load

An integer specifying the loading to plot.

ref

An integer giving the spectrum in spectra to use as a reference spectrum, which is plotted behind the loadings. Defaults to NULL which does not plot a reference spectrum.

load_lvls

A vector specifying the contour levels for the loadings pseudo-spectrum. If NULL, values are computed using calcLvls.

ref_lvls

A vector specifying the levels at which to compute contours for the reference spectrum. If NULL, values are computed using calcLvls.

load_cols

A vector specifying the colors for the contours in the laoding spectrum. If NULL, defaults to a scheme of values running from blue (low) to red (high), centered on green (zero).

ref_cols

A vector specifying the colors for the contours in the reference spectrum. If NULL, set to gray.

plot

Logical. Shall a plot be made? Plotting large data sets can be slow. Run the function with plot = FALSE, then use inspectLvls to figure out desirable levels, then set plot = TRUE.

...

Additional parameters to be passed to plotting functions. For instance showGrid = TRUE.

Value

The modified Spectra2D object is returned invisibly. The loadings matrix will be appended with a sample of name of Loadings_x where x = load. Side effect is a plot.

Scale

You can view the color scale for the plot via showScale.

Levels & Colors

The number of levels and colors must match, and they are used 1 for 1. If you provide n colors, and no levels, the automatic calculation of levels may return a number of levels other than n, in which case the function will override your colors and assign new colors for the number of levels it computed (with a message). To get exactly what you want, specify both levels and colors in equal numbers. Function inspectLvls can help you choose appropriate levels.

Overlaying Spectra

If you specify more than one spectrum to plot, e.g. which = c(1,2), then arguments lvls and cols must be lists of levels and colors, one list element for each spectrum to be plotted (if specified at all). Two convenience functions exist to make this process easier: LofL and LofC. See the examples.

Author(s)

Bryan A. Hanson, DePauw University.

See Also

Please see pfacSpectra2D, miaSpectra2D or popSpectra2D for examples.


[Package ChemoSpec2D version 0.5.0 Index]