Plot speclib

Share:

Description

Plot Speclib in a new plot or adding it to an existing plot.

Usage

1
2
3
4
5
6
## S4 method for signature 'Speclib,ANY'
plot(x, FUN = NULL, new = TRUE, ...)

## S4 method for signature 'Clman,ANY'
plot(x, ispec, subset = NULL, numeratepoints = TRUE, 
    hull.style = NULL, points.style = list(), ...)

Arguments

x

Object of class Speclib.

FUN

Name of a function (character) or index or ID of single spectrum to plot (integer).

new

If FALSE the plot is added to active existing plot.

ispec

Subscript of spectrum to be plotted.

subset

Vector of length = 2 containing minimum and maximum wavelength to plot.

numeratepoints

Flag if continuum points are numerated and labeled.

hull.style

List of arguments passed to lines to construct the continuum line.

points.style

List of arguments passed to points to construct the continuum points. May be NULL to suppress plotting of fix points.

...

Further arguments passed to internal plot functions or to plot for objects of class Speclib and Clman.

Details

The function may work in a couple of modes. The default way is to plot mean values (solid line) of all spectra and the standard deviations within bands. If data is assumed to be continuous the standard deviations are plotted as dashed lines otherwise error bars will indicate standard deviations.

The user has various options to change the way things are looking: With argument FUN the name of a function, the ID or the index of a certain spectrum may be specified. Note that if FUN is a function, this function will be applied to all spectra. If function should be applied to a subset of spectra, use function subset to define rules excluding certain spectra.

By passing a subset, the user may specify a spectral range to plot. Limits for x- and y-axis will be found automatically or may be passed separately.

Author(s)

Lukas Lehnert

See Also

Speclib

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(spectral_data)

## Set mask for channel crossing and water absorption bands
mask(spectral_data) <- c(1040, 1060, 1350, 1450)

## Simple example
plot(spectral_data, legend = list(x = "topleft"))

## Example with groups
plot(spectral_data, bygroups = TRUE, legend = list(x = "topleft"))

## Example with function
par(mfrow = c(2,3))
plot(spectral_data, FUN = "min", main = "Minimum of speclib")
plot(spectral_data, FUN = "max", main = "Maximum of speclib")
plot(spectral_data, FUN = "median", main = "Median of speclib")
plot(spectral_data, FUN = "mean", main = "Mean of speclib")
plot(spectral_data, FUN = "var", main = "Variance of speclib")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.