Plot spectra from tibble spectra objects.

plot_spc(spc_tbl, spc_tbl_2 = NULL,
  x_unit = "wavenumber",
  y = "spc", by = "unique_id",
  graph_id_1 = "Set 1", graph_id_2 = "Set 2",
  graph_id_1_col = "black", graph_id_2_col = "red",
  xlab = expression(paste("Wavenumber [", cm^-1, "]")),
  ylab = "Absorbance",
  alpha = 0.2, legend = TRUE)

Arguments

spc_tbl

Tibble that contains the first set of spectra to plot as list-column

spc_tbl_2

Tibble that contains the second set of spectra (optional) to plot as list-column.

x_unit

Character string describing the x axis unit. Default is "wavenumber", which will produce a graph with wavenumbers on the x axis with reversed number. If x_unit = "wavelength", the axis will be in regular order (lower wavelengths in nm on the left and higher on the right side of the axis).

y

Character string of list-column name in tibble where spectra of desired type are extracted to plot.

by

Character string of column that is used to group the spectra. Default is "unique_id". If replica spectra are present in the file and processed spectra resulting after averaging need to be plotted, it is recommend to use "sample_id" as argument to group according the sample_id column in the tibble(s) containing the spectra (spc_tbl and spc_tbl_2).

graph_id_1

Character string used for grouping the first spectra set (spc_tbl) and producing the label text accordingly. Default is "Set 1".

graph_id_2

Character string used for grouping the second spectra set (spc_tbl_2) and producing the label text accordingly. Default is "Set 2"

graph_id_1_col

Character string for the colour of the first spectra set. Default is "black".

graph_id_2_col

Character string for the colour of the first spectra set. Default is "red".

xlab

Character string or mathematical expression (use expression) for the x axis title. Default is expression(paste("Wavenumber [", cm^-1, "]")).

ylab

Character string or mathematical expression (use expression) for the y axis title. Default is "absorbance".

alpha

Double in between 0 and 1. Sets the transparency for the plotted spectra lines.

legend

Logical whether to plot a legend for the spectra describing its name selected in arguments graph_id_1 and graph_id_2. Default is TRUE.