Luminescence (version 0.8.6)

plot_RLum.Data.Spectrum: Plot function for an RLum.Data.Spectrum S4 class object

Description

The function provides a standardised plot output for spectrum data of an RLum.Data.Spectrum S4 class object

Usage

plot_RLum.Data.Spectrum(object, par.local = TRUE,
  plot.type = "contour", optical.wavelength.colours = TRUE,
  bg.channels, bin.rows = 1, bin.cols = 1, rug = TRUE,
  limit_counts = NULL, xaxis.energy = FALSE, legend.text, ...)

Arguments

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 rownames and colnames 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): plot type, for 3D-plot use persp, or interactive, for a 2D-plot 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.

bg.channels

vector (optional): defines channel for background subtraction If a vector is provided the mean of the channels is used for subtraction.

Note: Background subtraction is applied prior to channel binning

bin.rows

integer (with defaul): allow summing-up wavelength channels (horizontal binning), e.g. bin.rows = 2 two channels are summed up

bin.cols

integer (with default): allow summing-up channel counts (vertical binning) for plotting, e.g. bin.cols = 2 two channels are summed up

rug

logical (with default): enables or disables 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): enables or disables energy instead of wavelength axis.

Note: This option means not only simnply redrawing the axis, instead the spectrum in terms of intensity is recalculated, s. details.

legend.text

character (with default): possiblity to provide own legend text. This argument is only considered for plot types providing a legend, e.g. plot.type="transect"

...

further arguments and graphical parameters that will be passed to the plot function.

Value

Returns a plot.

Function version

0.5.3 (2018-01-21 17:22:38)

How to cite

Kreutzer, S. (2018). plot_RLum.Data.Spectrum(): Plot function for an RLum.Data.Spectrum S4 class object. Function version 0.5.3. In: Kreutzer, S., Burow, C., Dietze, M., Fuchs, M.C., Schmidt, C., Fischer, M., Friedrich, J. (2018). Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 0.8.6. https://CRAN.R-project.org/package=Luminescence

Details

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

Energy axis re-calculation

If the argument xaxis.energy = TRUE is chosen, instead intensity vs. wavelength the spectrum is plotted as intensiyt vs. energy. Therefore the entire spectrum is re-recaluated (e.g., Appendix 4 in Blasse and Grabmeier, 1994):

The intensity of the spectrum (z-values) is re-calcualted using the following equation:

$$\phi_{E} = \phi_{\lambda} * \lambda^2 / (hc)$$

with \(\phi_{E}\) the intensity per interval of energy \(E\) (eV), \(\phi_{\lambda}\) the intensity per interval of wavelength \(\lambda\) (nm) and \(h\) (eV/s) the Planck constant and \(c\) (m/s) the velocity of light.

For transforming the wavelength axis (x-values) the equation

$$E = hc/\lambda$$

is used. For further details please see the cited the literature.

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 persp:

  • shade: default is 0.4

  • phi: default is 15

  • theta: default is -30

  • expand: default is 1

  • 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) previous the function call.

plot.type = "single"

Per frame a single curve is returned. Frames are time or temperature steps.

plot.type = "multiple.lines"

All frames plotted in one frame.

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)

xlab, ylab, zlab, xlim, ylim, zlim, main, mtext, pch, type ("single", "multiple.lines", "interactive"), col, border, box lwd, bty, showscale ("interactive")

References

Blasse, G., Grabmaier, B.C., 1994. Luminescent Materials. Springer.

See Also

'>RLum.Data.Spectrum, plot, plot_RLum, persp, plotly::plot_ly, contour

Examples

Run this code
# NOT RUN {
##load example data
data(ExampleData.XSYG, envir = environment())

##(1)plot simple spectrum (2D) - contour
plot_RLum.Data.Spectrum(TL.Spectrum,
                        plot.type="contour",
                        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 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)

 ##(7) alternative using the package fields
 fields::image.plot(get_RLum(TL.Spectrum))
 contour(get_RLum(TL.Spectrum), add = TRUE)

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace