plot_spc_ext
is a custom plotting function developed
within the simplerspec framework. Returns plots based on ggplot2
(class "ggplot"). Different spectra types such as raw or preprocessed spectra
and groups can be differentiated by different colors or by using panels
(so called facets). Additionally, spectra can be colored based on an
additional measure variable, e.g. determined by chemical reference analysis.
plot_spc_ext(
spc_tbl,
spc_tbl_l = NULL,
lcols_spc = "spc",
lcol_measure = NULL,
lcol_measure_col_palette = "Spectral",
lcol_measure_col_direction = -1,
spc_id = "unique_id",
group_id = "sample_id",
group_id_order = TRUE,
group_color = TRUE,
group_color_palette = NULL,
group_panel = TRUE,
group_legend = FALSE,
ncol = NULL,
relabel_spc = TRUE,
ylab = "Spectrum value",
alpha = 0.5,
line_width = 0.2,
...
)
Tibble data frame containing spectra, x-axis values, metadata and eventual measured variables as list-columns.
List of spectral tibbles (data frames). Default is
NULL
(argument is not used).
Character vector of spectral list-columns to be extracted.
Default is "spc"
(raw spectra).
Character vector of length 1 denoting the column name
of the measure columns. This argument is optional. Default is NULL
,
which does not extract an additional measure column.
Palette value supplied to
ggplot::scale_colour_brewer()
. Default is "Spectral"
, but you can set
it to the default argument 1
(will use
scale_colour_brewer(..., palette = 1)
).
Sets the the order of colours in the scale
that is based on a measure column. Default is -1
which reverses the
scale. Argument is passed on to the function ggplot2::sclae_colour_brewer()
as argument direction
.
Character vector denoting column name for a unique spectrum ID.
Default is "unique_id"
.
Character vector denoting column name for the spectrum group
ID. Default is "sample_id"
. The group ID is used for
plotting spectra by group (e.g. by using different colors or panels).
Logical that specifies whether the panel names
derived from a numeric group_id
column are reordered using ascending
numbers. Default is TRUE
.
Logical defining whether spectra are colored by the column
specified by group_id
.
Character (1L) defining the diverging colour
scales from colorbrewer.org; see ?scale_colour_brewer
for supported
diverging colur types (palette
argument).
Logical defining whether spectra are arranged into panels
by groups specified in group_id
. Default is TRUE
.
Logical defining whether a legend for the group_id
is plotted. Default is FALSE
.
Integer vector of length 1. Defines number of columns when
plotting panels (facets). Default is NULL
(argument not used).
Logical defining whether panels are relabeled with custom
names for spectra types. Default is TRUE. When TRUE
, arguments
from relabel_spc_types
can be passed to plot_spc_ext
(supported via the ...
(ellipsis) argument)
Character vector or vector of type "expression"
created by
mathematical expression created by expression
. Custom annotation for
y-axis of spectra
Integer of length 1, from 0 to 1. Defines transparency of
spectral lines. Default is 0.5
(0 is completely transparent and
1 is no transparency).
Numeric vector of length 1 specifying the width of the
spectral lines. Default is 0.2
.
Further arguments to be passed to plot_spc_ext
. Currently,
arguments of relabel_spc_types
are supported.
Object of class "ggplot"
(ggplot2 graph).