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,
...
)
An object of S3 class Spectra2D
.
("Score Object") One of the following:
An object of class mia
produced by
function miaSpectra2D
.
An object of class pfac
produced by
function pfacSpectra2D
.
An object of class pop
produced by
function popSpectra2D
.
An integer specifying the loading to plot.
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.
A vector specifying the contour levels
for the loadings pseudo-spectrum.
If NULL
, values are computed using calcLvls
.
A vector specifying the levels at which to compute contours
for the reference spectrum.
If NULL
, values are computed using calcLvls
.
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).
A vector specifying the colors for the contours in the reference
spectrum. If NULL
, set to gray.
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
.
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.