| plot_shots | R Documentation |
Shows the shots of a LIBS data set and the shots rejected by
reject_shots(): their criteria, their spectra, the trends along the
shots, and the samples, to judge the rejection before averaging the
shots.
plot_shots(
x,
type = c("heatmap", "criteria", "spectra", "order", "samples"),
sample = NULL,
wavelength = NULL,
label = 10,
acquisition = NULL,
arrange = c("data", "extreme"),
smooth = NULL,
plot = TRUE,
title = NULL,
caption = TRUE,
base_size = 11,
xlab = NULL,
ylab = NULL,
point_size = NULL,
point_alpha = 0.85,
linewidth = 0.3
)
x |
The result of |
type |
The view: |
sample |
For |
wavelength |
For |
label |
For |
acquisition |
For |
arrange |
For |
smooth |
For |
plot |
A logical: plot ( |
title |
The plot title. A long title is split into a title and a subtitle. |
caption |
|
base_size |
The size of the text, in points. Default is 11. |
xlab, ylab |
For |
point_size |
For |
point_alpha |
For |
linewidth |
For |
Five views of the result of reject_shots():
"heatmap" (default): a map of the samples (rows) by the shot number
(columns), one panel per criterion, colored by the robust z-score of
each shot: white below 1 (the ordinary variability of the shots), then
in steps up to the cutoff and beyond it, the rejected shots outlined.
It shows at a glance the rejected shots, the samples whose shots vary
(rows), consecutive rejected shots (a problem of focus or surface
rather than a misfire), and the trends along the shot number
(columns). With acquisition, the rows follow the order of the
measurements; arrange = "extreme" puts the samples with the most
extreme shots first. With smooth = k (and acquisition), each cell
is the running median of the z-scores of that shot number over k
consecutive measurements, the rejected shots as points: the drift of
the shots along the acquisition (laser energy, fouling of the optics),
when the trend along the shot number changes from one period to
another. Without the acquisition order, neighboring rows are unrelated
samples, and smoothing them would invent patterns.
"criteria": the robust z-scores of the shots (total intensity against
the dissimilarity of shape, or the criteria used), with the cutoff:
the rejected shots are colored by their criteria, and the most extreme
labeled (sample and shot). Shots just beyond the cutoff are
borderline; a gap between the rejected shots and the others shows
clear outliers.
"spectra": the shots of one sample (sample, by default the sample
with the most rejected shots): the kept shots in grey, the median
spectrum in black, and each rejected shot in color, with its criteria,
its total intensity relative to the median shot and its correlation
with the median spectrum. wavelength zooms on a range.
"order": along the shot number, the total intensity of the shots
relative to their sample, their dissimilarity of shape to the median
spectrum of their sample (1 - r, on a log scale) and the share
of rejected shots. A trend shows the first shots on the surface of the
sample (cleaning shots) or the drift of the ablation in its crater,
which the rejection, made within each sample, does not correct:
discard the first shots, or check that the trend is the same for all
samples.
"samples": the number of samples by their number of rejected shots,
and the relative standard deviation (RSD) of the total intensity of
the shots of each sample, with all its shots and with the kept ones:
the gain of precision of the rejection, and the samples whose shots
vary most (heterogeneous samples, or a poor laser focus).
The shot numbers are the .shot column of reject_shots() (its shot
argument, or the order of the rows in each sample).
A ggplot (or patchwork) object, or with plot = FALSE a tibble.
Christian L. Goueguel
reject_shots(), forageShots
data(forageShots)
res <- reject_shots(forageShots, Measurement, shot = shot)
if (rlang::is_installed("patchwork")) {
# the samples by the shot number, in the order of the measurements
plot_shots(res, acquisition = Measurement)
# the drift of the shots along the acquisition: running medians over 5
# consecutive measurements
plot_shots(res, acquisition = Measurement, smooth = 5)
}
# the criteria of the shots, the rejected ones labeled
plot_shots(res, type = "criteria")
# the shots of the sample with the most rejected shots
plot_shots(res, type = "spectra")
# a zoom on the K I lines
plot_shots(res, type = "spectra", sample = 121306, wavelength = c(764, 772))
if (rlang::is_installed("patchwork")) {
# the trends along the shots, and the precision of the samples
plot_shots(res, type = "order")
plot_shots(res, type = "samples")
}
# the table of the samples
plot_shots(res, type = "samples", plot = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.