View source: R/plot_RLum.Data.Spectrum.R
| plot_RLum.Data.Spectrum | R Documentation |
The function provides a standardised plot output for spectrum data of an RLum.Data.Spectrum class object. The purpose of this function is to provide easy and straightforward spectra plotting, not a fully customised access to all plot parameters. If this is wanted, standard R plot functionality should be used instead.
Matrix structure
(cf. RLum.Data.Spectrum)
rows (x-values): wavelengths/channels (xlim, xlab)
columns (y-values): time/temperature (ylim, ylab)
cells (z-values): count values (zlim, zlab)
Note: This nomenclature is valid for all plot types of this function!
Nomenclature for value limiting
xlim: Limits values along the wavelength axis
ylim: Limits values along the time/temperature axis
zlim: Limits values along the count value axis
Details on the plot functions
Spectrum is visualised as 3D or 2D plot. Both plot types are based on internal R plot functions.
plot.type = "persp"
Arguments that will be passed to graphics::persp:
shade: default is 0.4
phi: default is 15
theta: default is -30
lphi: default is 15
ltheta: default is -30
expand: default is 1
axes: default is TRUE
box: default is TRUE; accepts "alternate" for a custom plot design
ticktype: default is detailed, r: default is 10
Note: Further parameters can be adjusted via par. For example
to set the background transparent and reduce the thickness of the lines use:
par(bg = NA, lwd = 0.7) before the function call.
plot.type = "single"
Per frame a single curve is returned. Frames are time or temperature steps.
-frames: pick the frames to be plotted (depends on the binning!). Check without
this setting before plotting.
plot.type = "multiple.lines"
All frames plotted in one frame.
-frames: pick the frames to be plotted (depends on the binning!). Check without
this setting before plotting.
plot.type = "image" or plot.type = "contour"
These plot types use the R functions graphics::image or graphics::contour.
The advantage is that many plots can be arranged conveniently using standard
R plot functionality. If plot.type = "image" a contour is added by default,
which can be disabled using the argument contour = FALSE to add own contour
lines of choice.
plot.type = "transect"
Depending on the selected wavelength/channel range a transect over the
time/temperature (y-axis) will be plotted along the wavelength/channels
(x-axis). If the range contains more than one channel, values (z-values) are
summed up. To select a transect use the xlim argument, e.g.
xlim = c(300,310) plot along the summed up count values of channel
300 to 310.
add: default is FALSE: adds the plot to an existing plot
smooth: default is FALSE: performs a simple curve smoothing
transect_mode: default is sum: sets the integration mode for the transect along the
wavelength axis. Other allowed values are mean, mean, min, max
Further arguments that will be passed (depending on the plot type)
xlab, ylab, zlab, xlim, ylim, zlim, main, mtext,
box, pch, type ("single", "multiple.lines", "interactive"),
col, border, lwd, bty, showscale ("interactive", "image")
contour, contour.col ("image"), labcex ("image", "contour"),
n_breaks ("image"), legend (TRUE/FALSE), legend.text ("multiple.lines"),
legend.pos ("image"), legend.horiz (TRUE/FALSE | "image")
plot_RLum.Data.Spectrum(
object,
par.local = TRUE,
plot.type = c("contour", "persp", "single", "multiple.lines", "image", "transect",
"interactive"),
optical.wavelength.colours = TRUE,
bg.spectrum = NULL,
bg.channels = NULL,
bin.rows = 1,
bin.cols = 1,
norm = FALSE,
rug = TRUE,
limit_counts = NULL,
xaxis.energy = FALSE,
plot = TRUE,
...
)
object |
RLum.Data.Spectrum or matrix (required):
S4 object of class RLum.Data.Spectrum or a |
par.local |
logical (with default):
use local graphical parameters for plotting, e.g. the plot is shown in one
column and one row. If |
plot.type |
character (with default):
for a 3D-plot use |
optical.wavelength.colours |
logical (with default):
use optical wavelength colour palette. Note: For this, the spectrum range is
limited: |
bg.spectrum |
RLum.Data.Spectrum or matrix (optional):
spectrum used for the background subtraction. The background spectrum should
be measured using the same setting as the signal spectrum. The argument
|
bg.channels |
vector (optional):
channels used for background subtraction. If the number of channels is
identical between the signal and background spectra, a channel-wise
subtraction is performed; otherwise this number is used to select channels
for calculating the arithmetic mean If a spectrum is provided via
Note: Background subtraction is applied prior to channel binning! |
bin.rows |
integer (with default):
allow summing-up wavelength channels (horizontal binning),
e.g. |
bin.cols |
integer (with default):
allow summing-up channel counts (vertical binning) for plotting,
e.g. |
norm |
logical, character (optional):
if logical, whether curve normalisation should occur ( |
rug |
logical (with default):
enable/disable colour rug. Currently only implemented for plot
type |
limit_counts |
numeric (optional): value to limit all count values to this value, i.e. all count values above this threshold will be replaced by this threshold. This is helpful especially in case of TL-spectra. |
xaxis.energy |
logical (with default): enable/disable using energy instead of wavelength on the x-axis. Function convert_Wavelength2Energy is used to perform the conversion. Note: Besides being used in setting the axis, with this option the the spectrum is recalculated in terms of intensity, see details. |
plot |
logical (with default): enable/disable the plot output. If
the plot output is disabled, the matrix used for the plotting and the
calculated colour values (as attributes) are returned. This way, the
(binned, transformed etc.) output can be used in other functions and
packages, such as plotting with the package |
... |
further arguments and graphical parameters that will be passed
to the |
Returns a plot and the transformed matrix used for plotting with some
useful attributes such as colour and pmat (the transpose matrix from
graphics::persp).
0.6.18
Kreutzer, S., 2026. plot_RLum.Data.Spectrum(): Plot function for an RLum.Data.Spectrum S4 class object. Function version 0.6.18. In: Kreutzer, S., Burow, C., Dietze, M., Fuchs, M.C., Schmidt, C., Fischer, M., Friedrich, J., Mercier, N., Philippe, A., Riedesel, S., Autzen, M., Mittelstrass, D., Gray, H.J., Galharret, J., Colombo, M., Steinbuch, L., de Boer, A., Bluszcz, A., 2026. Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 1.3.1. https://r-lum.github.io/Luminescence/
Not all additional arguments (...) will be passed similarly!
Sebastian Kreutzer, F2.1 Geophysical Parametrisation/Regionalisation, LIAG - Institute for Applied Geophysics (Germany) , RLum Developer Team
RLum.Data.Spectrum, convert_Wavelength2Energy, plot_RLum, graphics::persp, plotly::plot_ly, graphics::contour, graphics::image
##load example data
data(ExampleData.XSYG, envir = environment())
##(1)plot simple spectrum (2D) - image
plot_RLum.Data.Spectrum(
TL.Spectrum,
plot.type="image",
xlim = c(310,750),
ylim = c(0,300),
bin.rows=10,
bin.cols = 1)
##(2) plot spectrum (3D)
plot_RLum.Data.Spectrum(
TL.Spectrum,
plot.type="persp",
xlim = c(310,750),
ylim = c(0,100),
bin.rows=10,
bin.cols = 1)
##(3) plot spectrum on energy axis
##please note the background subtraction
plot_RLum.Data.Spectrum(TL.Spectrum,
plot.type="persp",
ylim = c(0,200),
bin.rows=10,
bg.channels = 10,
bin.cols = 1,
xaxis.energy = TRUE)
##(4) plot multiple lines (2D) - multiple.lines (with ylim)
plot_RLum.Data.Spectrum(
TL.Spectrum,
plot.type="multiple.lines",
xlim = c(310,750),
ylim = c(0,100),
bin.rows=10,
bin.cols = 1)
## Not run:
##(4) interactive plot using the package plotly ("surface")
plot_RLum.Data.Spectrum(TL.Spectrum, plot.type="interactive",
xlim = c(310,750), ylim = c(0,300), bin.rows=10,
bin.cols = 1)
##(5) interactive plot using the package plotly ("contour")
plot_RLum.Data.Spectrum(TL.Spectrum, plot.type="interactive",
xlim = c(310,750), ylim = c(0,300), bin.rows=10,
bin.cols = 1,
type = "contour",
showscale = TRUE)
##(6) interactive plot using the package plotly ("heatmap")
plot_RLum.Data.Spectrum(TL.Spectrum, plot.type="interactive",
xlim = c(310,750), ylim = c(0,300), bin.rows=10,
bin.cols = 1,
type = "heatmap",
showscale = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.