Plots the trace and/or spectrum for a given peak in peak table.
Usage
# S3 method for class 'peak_table'
plot(
x,
loc,
chrom_list = NULL,
what = "peak",
idx = "max",
lambda = "max",
plot_spectrum = TRUE,
plot_trace = TRUE,
box_plot = FALSE,
vars = NULL,
spectrum_labels = TRUE,
scale_spectrum = FALSE,
export_spectrum = FALSE,
verbose = TRUE,
engine = c("base", "plotly", "ggplot"),
...
)Arguments
- x
The peak table (output from
get_peaktable).- loc
A vector specifying the peak(s) or retention time(s) to plot.
- chrom_list
A list of chromatograms in matrix format (timepoints x wavelengths). If no argument is provided here, the function will try to find the
chrom_listobject using the pointer in thepeak_table.- what
What to look for. Either
peakto extract spectral information for a certain peak,rtto scan by retention time,idxto scan by numeric index, orclickto manually select retention time by clicking on the chromatogram. Defaults to"peak"mode.- idx
Numerical index of chromatogram you wish to plot; "max" to plot the chromatogram with the largest signal; or "all" to plot spectra for all chromatograms.
- lambda
The wavelength you wish to plot the trace at (if
plot_chromisTRUE. Otherwise, the wavelength to be used for the determination of signal abundance.- plot_spectrum
Logical. If
TRUE, plots the spectrum of the chosen peak. Defaults toTRUE.- plot_trace
Logical. If
TRUE, plots the trace of the chosen peak at lambda. Defaults toTRUE.- box_plot
Logical. If
TRUE, plots box plot using categories defined byvars.- vars
Independent variables for boxplot. Righthand side of formula.
- spectrum_labels
Logical. If
TRUE, plots labels on maxima in spectral plot. Defaults toTRUE.- scale_spectrum
Logical. If
TRUE, scales spectrum to unit height. Defaults toFALSE.- export_spectrum
Logical. If
TRUE, invisibly returns the spectrum as adata.frame. Defaults toFALSE.- verbose
Logical. If
TRUE(default), prints verbose output to the console.- engine
Which plotting engine to use:
base,ggplot2, orplotly.- ...
Additional arguments to boxplot.
Value
If
export_spectrum = FALSE(default), aplotlyorggplotobject, or nothing ifengine == "base".If
export_spectrum = TRUE, invisibly returns the spectrum as adata.framewith wavelengths as rows and a single column per sample encoding absorbance at each wavelength (normalized ifscale_spectrum = TRUE). Otherwise, ifengine == "base", there is no return value. Ifexport_spectrumisTRUE, returns the spectrum as adata.framewith wavelengths as rows and columns encoding the absorbance (or normalized absorbance, ifscale_spectrumisTRUE) for the specified sample(s).
Details
Can be used to confirm the identity of a peak or check that a particular column in the peak table represents a single compound. Can also be used to create simple box-plots to examine the distribution of a peak with respect to variables defined in sample metadata.
When plot_trace is TRUE, plots the chromatographic trace of the
specified chromatogram (idx), at the specified wavelength
(lambda) with a dotted red line to indicate the retention time given
by loc. The trace is a single column from the chromatographic matrix. When
plot_spectrum is TRUE, plots the spectrum for the specified
chromatogram at the specified retention time. The spectrum represents a single
row from the chromatographic matrix. When box_plot is TRUE, produces a
boxplot from the specified peak with groups defined by the vars argument.
See also
Other visualization functions:
boxplot.peak_table(),
mirror_plot(),
plot.peak_list(),
plot_all_spectra(),
plot_chroms(),
plot_chroms_heatmap(),
plot_spectrum(),
scan_chrom()
