ggspectra (version 0.3.12)

autoplot.waveband: Create a complete ggplot for a waveband descriptor.

Description

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

Usage

# S3 method for waveband
autoplot(
  object,
  ...,
  w.length = NULL,
  range = c(280, 800),
  fill = 0,
  span = NULL,
  wls.target = "HM",
  unit.in = getOption("photobiology.radiation.unit", default = "energy"),
  annotations = NULL,
  geom = "line",
  wb.trim = TRUE,
  norm = NULL,
  text.size = 2.5,
  ylim = c(NA, NA),
  object.label = deparse(substitute(object)),
  na.rm = TRUE
)

Value

a ggplot object.

Arguments

object

a waveband object.

...

currently ignored.

w.length

numeric vector of wavelengths (nm)

range

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

fill

value to use as response for wavelngths outside the waveband range.

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.

unit.in

the type of unit we assume as reference "energy" or "photon" based.

annotations

a character vector. For details please see section Plot Annotations.

geom

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

wb.trim

logical.

norm

numeric normalization wavelength (nm) or character string "max" for normalization at the wavelength of highest peak.

text.size

numeric size of text in the plot decorations.

ylim

numeric y axis limits,

object.label

character The name of the object being plotted.

na.rm

logical.

Plot Annotations

The recognized annotation names are: "summaries", "peaks", "peak.labels", "valleys", "valley.labels", "wls", "wls.labels", "colour.guide", "color.guide", "boxes", "segments", "labels". In addition, "+" is interpreted as a request to add to the already present default annotations, "-" as request to remove annotations and "=" or missing"+" and "-" as a request to reset annotations to those requested. If used, "+", "-" or "=" must be the first member of a character vector, and followed by one or more of the names given above. To simultaneously add and remove annotations one can pass a list containing character vectors each assembled as described. The vectors are applied in the order they appear in the list. To disable all annotations pass "" or c("=", "") as argument. Adding a variation of an annotation already present, replaces the existing one automatically: e.g., adding "peak.labels" replaces"peaks" if present.

Details

Note that scales are expanded so as to make space for the annotations. The object returned is a ggplot object, and can be further manipulated.

See Also

autoplot.response_spct, waveband.

Other autoplot methods: autoplot.calibration_spct(), autoplot.cps_spct(), autoplot.filter_spct(), autoplot.object_spct(), autoplot.raw_spct(), autoplot.reflector_spct(), autoplot.response_spct(), autoplot.source_spct(), set_annotations_default()

Examples

Run this code

autoplot(waveband(c(400, 500)))
autoplot(waveband(c(400, 500)), geom = "spct")

Run the code above in your browser using DataLab