View source: R/plot_ViolinPlot.R
| plot_ViolinPlot | R Documentation |
Draws a kernel density plot in combination with a boxplot in its middle.
The shape of the violin is constructed using a mirrored density curve.
This plot is especially designed for cases where the individual errors are
zero or too small to be visualised. The idea for this plot is based on the
'violin plot' in the ggplot2 package by Hadley Wickham and Winston Chang.
The general idea for the violin plot seems to have been introduced by
Hintze and Nelson (1998).
plot_ViolinPlot(
data,
boxplot = TRUE,
rug = TRUE,
summary = c("n", "median"),
summary.pos = "sub",
...
)
data |
numeric or RLum.Results (required):
input data for plotting. Alternatively a data.frame or a matrix can
be provided, but only the first column will be considered by the
function. Rows with |
boxplot |
logical (with default): enable/disable the boxplot. |
rug |
logical (with default): enable/disable the rug. |
summary |
character (with default): add statistic measures of centrality and dispersion to the plot. Can be one or more of several keywords. See details for available keywords. |
summary.pos |
numeric or character (with default):
optional position keywords (cf. legend) for the statistical summary.
Alternatively, the keyword |
... |
further arguments and graphical parameters passed to plot.default, stats::density and boxplot. See details for further information. |
The function is passing several arguments to the functions plot, stats::density, graphics::boxplot:
Supported arguments are:
xlim, main, xlab, ylab, col.violin, col.boxplot, mtext, cex, mtext
Valid summary keywords
'n', 'mean', 'median', 'sd.abs', 'sd.rel', 'se.abs', 'se.rel'.
'skewness', 'kurtosis'
0.1.4
Kreutzer, S., 2026. plot_ViolinPlot(): Create a violin plot. Function version 0.1.4. 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/
Although the code for this function was developed independently and just
the idea for the plot was based on the 'ggplot2' plot type 'violin', it
should be mentioned that, beyond this, at least another R package produces
this kind of plot, namely 'vioplot' (see references for details).
Sebastian Kreutzer, F2.1 Geophysical Parametrisation/Regionalisation, LIAG - Institute for Applied Geophysics (Germany) , RLum Developer Team
Daniel Adler (2025). vioplot: violin plot. R package version 0.5.1 http://CRAN.R-project.org/package=vioplot
Hintze, J.L., Nelson, R.D. (1998). A Box Plot-Density Trace Synergism. The American Statistician 52, 181-184.
Wickham. H (2009). ggplot2: elegant graphics for data analysis. Springer New York.
stats::density, plot, boxplot, rug, calc_Statistics
## read example data set
data(ExampleData.DeValues, envir = environment())
ExampleData.DeValues <- convert_Second2Gray(ExampleData.DeValues$BT998,
c(0.0438,0.0019))
## create plot straightforward
plot_ViolinPlot(data = ExampleData.DeValues)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.