R/plotLoadings2D.R
plotLoadings2D.Rd
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.
plotLoadings2D( spectra, so, load = 1, ref = NULL, load_lvls = NULL, ref_lvls = NULL, load_cols = NULL, ref_cols = NULL, plot = TRUE, ... )
spectra | An object of S3 class |
---|---|
so | ("Score Object") One of the following:
|
load | An integer specifying the loading to plot. |
ref | An integer giving the spectrum in |
load_lvls | A vector specifying the contour levels
for the loadings pseudo-spectrum.
If |
ref_lvls | A vector specifying the levels at which to compute contours
for the reference spectrum.
If |
load_cols | A vector specifying the colors for the contours in the laoding spectrum.
If |
ref_cols | A vector specifying the colors for the contours in the reference
spectrum. If |
plot | Logical. Shall a plot be made? Plotting large data sets can be slow.
Run the function with |
... | Additional parameters to be passed to plotting functions. For instance
|
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.
You can view the color scale for the plot via showScale
.
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.
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.
Please see pfacSpectra2D
, miaSpectra2D
or
popSpectra2D
for examples.
Bryan A. Hanson, DePauw University.