View source: R/manipulations.R
add_wavenumber_marker | R Documentation |
Add a vertical line marker, at a given wavenumber, to an FTIR plot, and label at the top of the plot with a provided text (or by default the wavenumber of the marker). This is useful for noting important wavenumbers.
This function can be called repeatedly. Note that older labels will be covered by newer labels if they overlap.
Ajoutez un marqueur de ligne verticale, à un nombre d'ondes donné, à un tracé FTIR, et l'étiquette en haut du tracé avec un texte fourni (ou par défaut le nombre d'ondes du marqueur). Cette fonction est utile pour noter les nombres d'ondes importants. Cette fonction peut être appelée plusieurs fois.
Notez que les vieux labels seront couverts par les nouveaux s'ils se chevauchent.
add_wavenumber_marker(
ftir_spectra_plot,
wavenumber,
text = NULL,
line_aesthetics = NULL,
label_aesthetics = NULL
)
ftir_spectra_plot |
A plot generated by Un tracé généré par |
wavenumber |
the wavenumber at which the marker should be placed. le nombre d'ondes auquel le marqueur doit être placé. |
text |
The text of the label over the marker (optional). If no text is provided, the label will show the wavenumber (rounded to the nearest whole number). Le texte de l'étiquette au-dessus du marqueur (facultatif). Si aucun texte n'est fourni, l'étiquette indiquera le nombre d'ondes (arrondi au nombre entier le plus proche). |
line_aesthetics |
A named Une |
label_aesthetics |
A named Une |
the FTIR plot as a ggplot2 object, with a marker added at the specified wavenumber.
le tracé IRTF en tant qu'objet ggplot2, avec un marqueur ajouté au nombre d'ondes spécifié.
See vignette("ggplot2-specs")
for more information on setting
aesthetics.
Voir vignette("ggplot2-specs")
pour plus d'informations sur la définition
de l'esthétique.
add_band()
if (requireNamespace("ggplot2", quietly = TRUE)) {
# Generate a plot
biodiesel_plot <- plot_ftir(biodiesel)
# Add a marker at 1742 cm^-1 for the carbonyl C=O Stretch
p <- add_wavenumber_marker(biodiesel_plot, 1742, text = "C=O Stretch")
p
# Add a second marker and use a dashed line for the C-H aliphatic stretch
add_wavenumber_marker(p, 2920,
text = "C-H Stretch",
line_aesthetics = list("linetype" = "dashed")
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.