View source: R/np_plotting_functions.R
drawViolinPlot | R Documentation |
Produce a violin plot with optional box plot and strip plot overlays
drawViolinPlot(
x,
groups,
at = seq(1, length(levels(groups))),
h = NULL,
plotColors = basicTheme$plotColors,
sidePlot = FALSE,
borderCol = plotColors$lines,
borderWidth = 1,
fill = plotColors$fill,
width = 1,
trimViolins = TRUE,
samplePoints = NULL
)
x |
numeric; A vector of numeric values that will be subset and formated by the factor(s) in |
groups |
factor; A factor used to subset |
at |
numeric; a numeric vector of where each factor level should be plotted |
h |
numeric; Bandwidth for the kernel density estimates. Will cycle over values if multiple bandwidths are given |
plotColors |
list; a named list of vectors of colors that set the color options for all NicePlot functions. |
sidePlot |
logical; If |
borderCol |
R color string; Color of the border of the violins |
borderWidth |
numeric; Thickness of the violin borders (lwd) |
fill |
R color string; Color of the interior of the violins |
width |
numeric; Relative width of the violins. A value of 1 will cause the violins to cover their entire lane and potentially just touch. |
trimViolins |
logical; Should the violins be truncated at the edges of the data range. |
samplePoints |
integer; The number of points used to draw each side of the violin. This is generally obtained from |
This uses bkde
from the KernSmooth
package to calculated kernel density estimates and estimate the
optimal bandwidth h
setting. This data is then used to draw a violin plot with an optional boxplot drawn as an overlay
to better characterize the quartile distribution. Likewise, a strip chart of individual data points
can be added on top of these two plots to full characterize the data distribution. This uses niceBox
to handle
the box plot and strip chart overlays.
niceVio
, bkde
, dpik
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.