Plot function for an RLum.Data.Spectrum S4 class object
Plot function for an RLum.Data.Spectrum S4 class object
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 straight-forward spectra plotting, not provide a full customised access to all plot parameters. If this is wanted, standard R plot functionality should be used instead.
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.
Further arguments that will be passed (depending on the plot type)
object: RLum.Data.Spectrum or matrix (required ): S4 object of class RLum.Data.Spectrum or a matrix containing count values of the spectrum.
Please note that in case of a matrix row names and col names are set automatically if not provided.
par.local: logical (with default): use local graphical parameters for plotting, e.g. the plot is shown in one column and one row. If par.local = FALSE global parameters are inherited.
plot.type: character (with default): for a 3D-plot use persp
or interactive; for a 2D-plot you can use image, contour, single or multiple.lines (along the time or temperature axis) or transect (along the wavelength axis)
optical.wavelength.colours: logical (with default): use optical wavelength colour palette. Note: For this, the spectrum range is limited: c(350,750). Own colours can be set with the argument col. If you provide already binned spectra, the colour assignment is likely to be wrong, since the colour gradients are calculated using the bin number.
bg.spectrum: RLum.Data.Spectrum or matrix (optional): Spectrum used for the background subtraction. By definition, the background spectrum should have been measured with the same setting as the signal spectrum. If a spectrum is provided, the argument bg.channels works only on the provided background spectrum.
bg.channels: vector (optional): defines the channels used for background subtraction. If a vector is provided, the mean of the channels is used for subtraction. If a spectrum is provided via bg.spectrum, this argument only works on the background spectrum.
Note: Background subtraction is applied prior to channel binning
bin.rows: integer (with default): allow summing-up wavelength channels (horizontal binning), e.g. bin.rows = 2 two channels are summed up. Binning is applied after the background subtraction.
bin.cols: integer (with default): allow summing-up channel counts (vertical binning) for plotting, e.g. bin.cols = 2 two channels are summed up. Binning is applied after the background subtraction.
norm: character (optional): Normalise data to the maximum (norm = "max") or minimum (norm = "min") count values. The normalisation is applied after the binning.
rug: logical (with default): enable/disable colour rug. Currently only implemented for plot type multiple.lines and single
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.
legend.text: character (with default): possibility to provide own legend text. This argument is only considered for plot types providing a legend, e.g. plot.type="transect"
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 'plot3D'
...: further arguments and graphical parameters that will be passed to the plot function.
Returns
Returns a plot and the transformed matrix used for plotting with some useful attributes such as the colour and pmat (the transpose matrix from graphics::persp )
Description
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 straight-forward spectra plotting, not provide a full customised access to all plot parameters. If this is wanted, standard R plot functionality should be used instead.
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.
Further arguments that will be passed (depending on the plot type)
Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany) , RLum Developer Team
How to cite
Kreutzer, S., 2025. plot_RLum.Data.Spectrum(): Plot function for an RLum.Data.Spectrum S4 class object. Function version 0.6.9. 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., Boer, A.d., 2025. Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 1.0.1. https://r-lum.github.io/Luminescence/