In a second step, max.fn searches for the actual point to label
within the specified wavelength window of that spectrum. This allows to
label maxima (or minima) without demanding too precise clicks. Currently,
the following functions to determine the precise point:
|
spc.point.default |
uses the clicked wavelength together with its
spectral intensity |
| spc.point.max |
the point with the highest
intensity in the wavelength window |
| spc.point.min |
the point with
the lowest intensity in the wavelength window |
| spc.point.sqr |
maximum of a parabola fit throug the point with highest intensity and the
two surrounding points |
point.fn is called with the arguments
wl containing the considered wavelength window, spc the
respective intensities of the closest spectrum, and wlclick the
wavelength that was clicked. They return a vector of two elements
(wavelength and intensity).
As a last step, a label for the point produced by formatter and
plotted using text. Currently, the following
formatters are available:
| spc.label.default |
spectrum number, wavelength |
| spc.label.wlonly |
wavelength |
formatter functions receive the number of the spectrum ispc,
the wavelength wl, and the spectral intensity spc and produce
a character variable suitable for labelling. The predefined formatters
surround the label text by spaces in order to easily have an appropriate
offset from the point of the spectrum.
The warning issued if no spectral point is inside the tolerance window may
be switched of by warn = FALSE. In that case, the click will produce
a row of NAs in the resulting data.frame.
spc.identify uses option debuglevel to determine whether debugging output should be
produced. debuglevel == 2 will plot the tolerance window for every clicked point,
debuglevel == 1 will plot the tolerance window only if no data point was inside. See
hyperSpec options for details about retrieving and setting
options.
You may want to adjust the plot's ylim to ensure that the labels are
not clipped. As a dirty shortcut, xpd = NA may help.