plotScores | R Documentation |
Plots the requested scores using the color scheme derived from the
Spectra
or Spectra2D
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.
plotScores(
spectra,
so,
pcs = c(1, 2),
ellipse = "none",
tol = "none",
use.sym = FALSE,
leg.loc = "topright",
...
)
spectra |
An object of S3 class |
so |
"Score Object" One of the following:
Any of the above score objects will have been modified to include a
list element called |
pcs |
A vector of two integers specifying the components (scores) to plot. |
ellipse |
A character vector specifying the type of ellipses to be
plotted. One of |
tol |
A number describing the fraction of points to be labeled. |
use.sym |
A logical; if TRUE, the color scheme is set to black and the
points plotted with symbols. Applies only to |
leg.loc |
Either a list with elements |
... |
Parameters to be passed to the plotting routines. Applies to base graphics only. |
The returned value depends on the graphics option selected (see GraphicsOptions()
).
base
: None. Side effect is a plot.
ggplot2
: The plot is displayed, and a ggplot2
object is returned if the value is assigned. The plot can be modified in the usual ggplot2
manner.
Bryan A. Hanson (DePauw University), Tejasvi Gupta.
if (checkForPackageWithVersion("ChemoSpec", 6.0)) {
library("ChemoSpec")
# This example assumes the graphics output is set to ggplot2 (see ?GraphicsOptions).
library("ggplot2")
data(metMUD1)
pca <- c_pcaSpectra(metMUD1)
p <- plotScores(metMUD1, pca, pcs = c(1, 2), ellipse = "cls", tol = 0.05)
p <- p + ggtitle("metMUD1 NMR Data")
p
}
if (checkForPackageWithVersion("ChemoSpec2D", 0.5)) {
library("ChemoSpec2D")
library("ggplot2")
data(MUD1)
mia <- miaSpectra2D(MUD1)
p1 <- plotScores(MUD1, mia, tol = 0.1, ellipse = "cls")
p1 <- p1 + ggtitle("MIA Scores")
p1
set.seed(123)
pfac <- pfacSpectra2D(MUD1, parallel = FALSE, nfac = 2)
p2 <- plotScores(MUD1, pfac, tol = 0.1, leg.loc = "bottomright")
p2 <- p2 + ggtitle("PARAFAC Score Plot")
p2
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.