Draws fitted peak shapes over chromatographic traces to assess integration accuracy.
Usage
# S3 method for class 'peak_list'
plot(
x,
...,
chrom_list,
idx = 1,
lambda = NULL,
targets = NULL,
tol = 0.1,
pad = 0.5,
points = FALSE,
ticks = FALSE,
alpha = 0.5,
color = NULL,
cex.points = 0.5,
numbers = FALSE,
cex.font = 0.5,
digits = 2,
y.offset = 0.03,
plot_purity = c("none", "ratio", "curves", "curves_local"),
purity_args = list(),
res
)Arguments
- x
A
peak_listobject. Output from theget_peaksfunction.- ...
Additional arguments to main plot function. The plot is titled with the sample, wavelength and peak model by default; pass
mainto change the title, ormain = ""to omit it, andxaxt = "n"oryaxt = "n"to hide an axis.- chrom_list
List of chromatograms (retention time × wavelength matrices). If missing, extracted from environment using the pointer in
x.- idx
Index or name of chromatogram to plot from
chrom_list.- lambda
Wavelength (column) to use for plotting. Defaults to the first wavelength in
x.- targets
Optional target retention times, as a numeric vector or a table of targets (see
targeted_analysis). If supplied, the plot is zoomed to the span of every peak whose apex falls withintolof a target, or, for a target with no such peak, whose boundaries (widened bytol) enclose it. The vertical axis is rescaled to the contents of that window, so that small peaks are not flattened against the axis. Defaults toNULL.- tol
Numeric. Half-width of the window around each target, in minutes, regardless of the time unit of
chrom_list. Either a single value applied to every target, or a vector giving a separate tolerance for each target. Atolcolumn intargetstakes precedence. Defaults to0.1. Ignored iftargetsisNULL.- pad
Fraction of the selected peak span to add on either side when zooming. Defaults to
0.5, which keeps neighboring peaks in view. An explicitxlimorylimpassed through...takes precedence over the zoom; ifxlimis given, the vertical axis is rescaled to that window instead.- points
Logical. If
TRUE, display peak apex locations as points. Defaults toFALSE.- ticks
Logical. If
TRUE, mark peak boundaries with tick marks. Defaults toFALSE.- alpha
Transparency of fitted peak shapes. Defaults to
0.5.- color
Color used to fill fitted peak shapes. If
NULL, the color depends on the fitted model type.- cex.points
Size of points. Defaults to
0.5.- numbers
Labels drawn above each peak.
TRUElabels peaks with their index in the peak list, and"rt"labels them with their retention time, which can be passed back totargets. Defaults toFALSE.- cex.font
Font size if peaks are numbered. Defaults to
0.5.- digits
Number of decimal places for retention time labels when
numbers = "rt". Defaults to2.- y.offset
Vertical offset of peak numbers, as a fraction of the height of the plot region. Defaults to
0.03.- plot_purity
Whether and how to draw peak purity traces below the chromatogram.
"none"(default) draws nothing."ratio"plots the purity ratio as lollipops on a log scale from 0.01 to 100, clamping values beyond it: blue for pure (ratio < 1), red for impure, with a dotted reference line at ratio = 1."curves"draws spectral dissimilarity (1 - r^2) against the noise threshold on a fixed [0, 1] scale. The threshold is a gray dotted line, and the dissimilarity line is blue where it falls below the threshold (pure) and red where it exceeds it (impure)."curves_local"is the same, but rescales each peak to its own maximum.TRUEmaps to"curves"andFALSEto"none".- purity_args
A named list of additional arguments controlling the purity calculation, e.g.
list(background_correction = "none"). Seeget_purity. Arguments that do not apply to the per-peak purity trace drawn here (metric,min_runandtry) are ignored, so the same list can be passed toget_peaksand to this function.- res
Time resolution for peak fitting. If missing, inferred from
chrom_list.
Details
The appearance of fitted peaks depends on the "fit" attribute of x, which
may be "gaussian", "egh", "bemg", or "raw".
Peak lists must contain columns rt, height, start, end, and sd,
with additional columns depending on the fit type.
Width parameters are rescaled using the time units of x.
A peak whose shape cannot be drawn is skipped with a warning.
Side effects
Plots the trace of chromatogram idx at wavelength lambda, with the
fitted peak shapes from x filled in beneath it.
See also
Other visualization functions:
boxplot.peak_table(),
mirror_plot(),
plot.chrom_list(),
plot.matched_peak_list(),
plot.peak_table(),
plot_all_spectra(),
plot_chrom_contour(),
plot_chroms(),
plot_chroms_heatmap(),
plot_spectrum(),
scan_chrom()



