Learn R Programming

ggspectra (version 0.3.13)

raw_plot: Create a complete ggplot for raw detector-counts spectra.

Description

Plot method for spectra expressed as raw detector counts.

Usage

raw_plot(
  spct,
  w.band,
  range,
  pc.out,
  label.qty,
  span,
  wls.target,
  annotations,
  geom,
  relative,
  text.size,
  idfactor,
  facets,
  ylim,
  na.rm
)

Value

a ggplot object.

Arguments

spct

a raw_spct object.

w.band

list of waveband objects.

range

an R object on which range() returns a vector of length 2, with min annd max wavelengths (nm).

pc.out

logical, if TRUE use percents instead of fraction of one.

label.qty

character string giving the type of summary quantity to use for labels, one of "mean", "total", "contribution", and "relative".

span

a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centered at that element.

wls.target

numeric vector indicating the spectral quantity values for which wavelengths are to be searched and interpolated if need. The character strings "half.maximum" and "half.range" are also accepted as arguments. A list with numeric and/or character values is also accepted.

annotations

a character vector.

geom

character The name of a ggplot geometry, currently only "area", "spct" and "line". The default NULL selects between them based on stacked.

text.size

numeric size of text in the plot decorations.

idfactor

character Name of an index column in data holding a factor with each spectrum in a long-form multispectrum object corresponding to a distinct spectrum. If idfactor=NULL the name of the factor is retrieved from metadata or if no metadata found, the default "spct.idx" is tried.

facets

logical or integer Indicating if facets are to be created for the levels of idfactor when spct contain multiple spectra in long form.

ylim

numeric y axis limits,

na.rm

logical.

Details

This function returns a ggplot object with an annotated plot of a raw_spct object.

Note that scales are expanded so as to make space for the annotations. The object returned is a ggplot objects, and can be further manipulated. When spct has more than one column with spectral data, each of these columns is normalized individually.