Function to plot classic violin plots, as well as "half violin plots" (density plots).

violinPlot(x, at, .range = 1, add = FALSE, horizontal = TRUE,
  which = "both", relToAt = "above", plotQBox = TRUE, plotMed = TRUE,
  col = "orangered", border = "black", lwd = par("lwd"),
  colQBox = "black", borderQBox = "black", colMed = "white",
  pchMed = 19, res = 500, main = "")

Arguments

x

vector of values to plot

at

position of the plot when add is TRUE

.range

maximum height if horizontal or width if vertical of the plot when add is set to FALSE

add

logical, determining whether the plot should be added to an existing plot window

horizontal

logical, determining whether the plot should be horizontal, if FALSE the plot will be vertical

which

string, either "both" for a classic violing plot, or "top" or "bottom" to plot only the half violin

relToAt

string, one of "centered", "above", "below", "left", "right". Determining the relative position to at.

plotQBox

logical, determining whether the quantile box should be plotted

plotMed

logical, determining whether the median should be plotted

col

color of the violin

border

color of the border of the violin

lwd

line width if the border of the violin

colQBox

color of quantile box

borderQBox

color of the border of the quantile box

colMed

color of the median point

pchMed

pch for median point

res

"resolution" of the violin. Determining how many descrete points should be used to calculate the density kernel.

main

header text, only applicable, if 'add' is FALSE