Learn R Programming

ChemoSpec (version 4.3.34)

plotSpectraDist: Plot the Distance Between Spectra 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).

References

https://github.com/bryanhanson/ChemoSpec

Examples

Run this code
  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
  tst <- plotSpectraDist(SrE.NMR, xlab = txt2, ylab = txt1, main = txt1,
  	xlim = c(1,16), ylim = c(0, 0.3), srt = 90)

Run the code above in your browser using DataLab