Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotSpectraDist

Plot the Distance Between Spectra and a Reference Spectrum in a Spectra Object


Description

This function plots the distance between a reference spectrum and all other spectra in a Spectra object. Distance can be defined in a number of ways (see Arguments).

Usage

plotSpectraDist(spectra, method = "pearson", ref = 1, labels = TRUE, ...)

Arguments

spectra

An object of S3 class Spectra.

method

Character. Any method acceptable to rowDist.

ref

Integer. The spectrum to be used as a reference.

labels

Logical. Shall the points be labeled?

...

Plot parameters to be passed to the plotting routines.

Value

A data frame containing the data plotted (sample names, sample colors, distances).

Author(s)

Bryan A. Hanson, DePauw University.

See Also

To compare all spectra simultaneously in a heatmap, see sampleDist. Additional documentation at https://bryanhanson.github.io/ChemoSpec/

Examples

data(SrE.NMR)
txt1 <- paste("Distance from", SrE.NMR$names[1]) # capture before padding
txt2 <- paste("Rank Distance from", SrE.NMR$names[1])
SrE.NMR$names <- paste("  ", SrE.NMR$names, sep = "") # pad the names for better appearance
temp <- plotSpectraDist(SrE.NMR,
  xlab = txt2, ylab = txt1, main = txt1,
  ylim = c(0, 1.1), xlim = c(0, 16), srt = 45
)

ChemoSpec

Exploratory Chemometrics for Spectroscopy

v5.3.11
GPL-3
Authors
Bryan A. Hanson [aut, cre] (<https://orcid.org/0000-0003-3536-8246>), Mike Bostock [cph, ctb] (author of the d3.js library used by plotSpectraJS, http://d3js.org), Matt Keinsley [ctb] (author of initial AOV-PCA code)
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.