R: Plot the Distance Between Spectra in a Spectra Object

plotSpectraDist {ChemoSpec} | R Documentation

## 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).

### Author(s)

Bryan A. Hanson, DePauw University.

### References

https://github.com/bryanhanson/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,
      xlim = c(1,16), ylim = c(0, 0.3), srt = 90)

[Package ChemoSpec version 4.4.97 Index]