| plot_som | R Documentation |
Draws a map fitted by som(): the number of spectra per unit, the
distances between neighboring prototypes, the component planes, the
spectra on the map, or the prototype spectra.
plot_som(
object,
type = c("counts", "umatrix", "quality", "component", "mapping", "prototypes"),
variables = NULL,
color_by = NULL,
newdata = NULL,
units = NULL,
title = NULL,
wavelength = NULL,
xlab = NULL,
ylab = NULL,
base_size = 11,
point_size = 1.6,
point_alpha = 0.8,
linewidth = 0.4,
colour = deprecated()
)
object |
A map fitted by |
type |
The plot: |
variables |
For |
color_by |
For |
newdata |
For |
units |
For |
title |
The plot title. |
wavelength |
For |
xlab, ylab |
For |
base_size |
The size of the text, in points. Default is 11. |
point_size, point_alpha |
For |
linewidth |
For |
colour |
The types of plot are:
"counts": the number of training spectra on each unit (empty units
in white).
"umatrix": the unified distance matrix, the mean distance of each
prototype to those of its neighbors: high values (light) are the
boundaries between groups of similar spectra, low values (dark) the
groups themselves.
"quality": the mean quantization error of the spectra of each unit.
"component": the component planes, the value of the prototypes at
each of the variables (one panel per variable): which units have
intense emission lines. Each plane is scaled from its lowest (0) to its
highest (1) unit, so that weak lines are as readable as strong ones.
"mapping": the training spectra on their units (spread within the
unit), colored by color_by, and, with newdata, the new spectra as
triangles, the novel ones circled in red.
"prototypes": the prototype spectra of the units against
wavelength. By default, six prototypes spread over the map: the unit
with the most spectra, then, in turn, the unit whose prototype is the
farthest from those already chosen.
A ggplot object.
som(), predict.specproc_som()
data(forageLIBS)
# the Na I and K I resonance lines
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which((wl > 585 & wl < 595) | (wl > 760 & wl < 780))]
fit <- som(spectra)
plot_som(fit, type = "umatrix")
# component planes of the K I and Na I lines
plot_som(fit, type = "component", variables = c(769.90, 589.59))
plot_som(fit, type = "mapping", color_by = forageLIBS$K)
plot_som(fit, type = "prototypes", wavelength = c(760, 780))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.