View source: R/manipulations.R
rename_plot_sample_ids | R Documentation |
This function permits renaming Sample IDs as shown in the legend of a plot. While typically having proper names assigned in the data is preferred, this function allows for names to be modified after plot creation.
Cette fonction permet de renommer les identifiants des échantillons dans la légende d'un tracé. Bien qu'il soit préférable d'attribuer les noms appropriés dans les données, cette fonction permet de modifier les noms après la création du tracé.
rename_plot_sample_ids(ftir_spectra_plot, sample_ids)
ftir_spectra_plot |
A plot generated by Un tracé généré par |
sample_ids |
A named vector of format Un vecteur nommé du format |
the FTIR plot as a ggplot2 object, with samples renamed in the legend.
le tracé IRTF en tant qu'objet ggplot2, avec les échantillons renommés dans la légende.
if (requireNamespace("ggplot2", quietly = TRUE)) {
# Generate a plot
p <- plot_ftir(sample_spectra)
# Rename Samples in Legend:
new_ids <- c(
"Toluene" = "toluene", "C7 Alkanes" = "heptanes", "IPA" = "isopropanol",
"White Paper" = "paper", "PS Film" = "polystyrene"
)
rename_plot_sample_ids(p, new_ids)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.