add_band: Add Band

View source: R/manipulations.R

add_bandR Documentation

Add Band

Description

Add a shaded band (with optional text overlay) to a FTIR spectral region, to visually highlight an area.

Ajoutez une bande ombrée (avec un texte en option) à une région spectrale FTIR, pour mettre visuellement en évidence une zone.

Usage

add_band(
  ftir_spectra_plot,
  wavenumber_range,
  text = NULL,
  colour = NULL,
  label_aesthetics = NULL
)

Arguments

ftir_spectra_plot

A plot generated by plot_ftir() or plot_ftir_stacked().

Un tracé généré par plot_ftir() ou plot_ftir_stacked().

wavenumber_range

A vector of length two, with the wavenumber range of the shaded band. Order of provided limits is not important.

Un vecteur de longueur deux, avec la gamme de nombres d'ondes de la bande ombrée. L'ordre des limites fournies n'est pas important.

text

The text of the label over the band (optional).

Le texte de l'étiquette au-dessus du bande (facultatif).

colour

A colour for the shaded band. Note that alpha will be set to 0.5. A default blue band will be added if not provided. See vignette("ggplot2-specs", "ggplot2") for more information on aesthetics in graphics.

Une couleur pour la bande ombrée. Notez que la valeur alpha est fixée à 0,5. Une bande bleue sera ajoutée par défaut si aucune valeur n'est fournie. Voir ⁠vignette(« ggplot2-specs », « ggplot2 »)⁠ pour plus d'informations sur l'esthétique dans les graphiques.

label_aesthetics

A named list of aesthetics to pass to ggplot for creating the label. See ⁠[ggplot2::geom_text()]⁠'s aesthetics section for more info. Specifically, alpha, ⁠colo(u)r⁠, family, fill, fontface and sizeare permitted. Positioning aesthetics will be removed.

Une list nommée d'esthétiques à transmettre à ggplot pour créer l'étiquette. Voir la section esthétique de ⁠[ggplot2::geom_text()]⁠ pour plus d'informations. Plus précisément, alpha, ⁠colo(u)r⁠, family, fill, fontface et size sont autorisés. Les aspects esthétiques du positionnement seront supprimés.

Value

the FTIR plot as a ggplot2 object, with the shaded band added.

le tracé FTIR en tant qu'objet ggplot2, avec la bande ombrée ajoutée.

See Also

add_wavenumber_marker()

Examples

if (requireNamespace("ggplot2", quietly = TRUE)) {
  # Generate a plot
  p <- plot_ftir(sample_spectra)

  # Add a band to -OH region:
  add_band(p, c(3600, 3100), "-OH Stretch")
}

PlotFTIR documentation built on April 13, 2025, 5:11 p.m.