Draws a kernal densiy 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 to small to be visualised. The idea for this plot is
based on the the 'volcano plot' in the ggplot2 package by Hadely Wickham and Winston Chang.
The general idea for the Violin Plot seems to be introduced by Hintze and Nelson (1998).
numeric or RLum.Results
object (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
boxplot
logical (with default): enable or disable boxplot
rug
logical (with default): enable or disable rug
summary
character (optional): 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 "sub" may be
specified to place the summary below the plot header. However, this latter
option in only possible if mtext is not used.
na.rm
logical (with default): exclude NA values
from the data set prior to any further operations.
...
further arguments and graphical parameters passed to
plot.default, density and boxplot. See details for
further information
Details
The function is passing several arguments to the function plot,
density, boxplot:
Supported arguments are: xlim, main, xlab,
ylab, col.violin, col.boxplot, mtext, cex, mtext
Although the code for this function was developed independently and just the idea for the plot
was based on the 'ggplot2' package plot type 'volcano', it should be mentioned that, beyond this,
two other R packages exist providing a possibility to produces this kind of plot, namely:
'vioplot' and 'violinmplot' (see References for details).
Author(s)
Sebastian Kreutzer, IRAMAT-CRP2A, Universite Bordeaux Montaigne (France)
R Luminescence Package Team
References
Daniel Adler (2005). vioplot: A violin plot is a combination of a box plot and a kernel density plot.
R package version 0.2 http://CRAN.R-project.org/package=violplot
Hintze, J.L., Nelson, R.D., 1998. A Box Plot-Density Trace Synergism. The American Statistician 52, 181-184.
Raphael W. Majeed (2012). violinmplot: Combination of violin plot with mean and standard deviation.
R package version 0.2.1. http://CRAN.R-project.org/package=violinmplot
Wickham. H (2009). ggplot2: elegant graphics for data analysis. Springer New York.
See Also
density, plot, boxplot, rug,
calc_Statistics
Examples
## read example data set
data(ExampleData.DeValues, envir = environment())
ExampleData.DeValues <- Second2Gray(ExampleData.DeValues$BT998, c(0.0438,0.0019))
## create plot straightforward
plot_ViolinPlot(data = ExampleData.DeValues)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Luminescence)
Welcome to the R package Luminescence version 0.6.0 [Built: 2016-05-30 16:47:30 UTC]
A fluvially transported quartz grain at night: 'Always look at the bright side of life.'
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Luminescence/plot_ViolinPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot_ViolinPlot
> ### Title: Create a violin plot
> ### Aliases: plot_ViolinPlot
>
> ### ** Examples
>
> ## read example data set
> data(ExampleData.DeValues, envir = environment())
> ExampleData.DeValues <- Second2Gray(ExampleData.DeValues$BT998, c(0.0438,0.0019))
>
> ## create plot straightforward
> plot_ViolinPlot(data = ExampleData.DeValues)
Warning message:
[plot_ViolinPlot()] 2 NA values removed!
>
>
>
>
>
>
> dev.off()
null device
1
>