find_idfactor: Find 'idfactor'

View source: R/common-plot-utils.R

find_idfactorR Documentation

Find 'idfactor'

Description

Find if an 'idfactor' is present and build a suitable plot chuck.

Usage

find_idfactor(
  spct,
  idfactor,
  annotations,
  facets,
  map.linetype,
  num.columns = 1L,
  ...
)

Arguments

spct

generic_spct or derived object

idfactor

character Name of an index column in data holding a factor with each spectrum in a long-form multispectrum object corresponding to a distinct spectrum. If idfactor=NULL the name of the factor is retrieved from metadata or if no metadata found, the default "spct.idx" is tried. If idfactor=NA no aesthetic is mapped to the spectra and the user needs to use 'ggplot2' functions to manually map an aesthetic or use facets for the spectra.

annotations

a character vector.

facets

logical or numeric Flag indicating if facets are to be created when the data contains multiple spectra, if numeric the number of columns.

map.linetype

logical flag indicating that the id is to be mapped to the linetype aesthetic.

num.columns

numeric Number of data columns from multiple scans. Relevant only to raw_spct and cps_spct objects.

...

currently not used.

Details

Implement facets and/or a mapping to linetype. The mapping to linetype is done only if the number of spectra is <= 13 because of the number of values available in the scale.

Value

A list object containing a list of ggplot components and a vector of annotations names as members.


aphalo/ggspectra documentation built on June 10, 2025, 4:56 p.m.