pos: Position at which to place violin in the axis perpendicular to x. Defaults to 0
x2: Optional variable to override the use of x as input variable for the plotting statistic. If x2 is set, the function (default: density()) used to calculate the plotting statistic is run on x2 instead of x, but the results are plotted at the corresponding values of x.
stat: The plotting statistic. Details to the density() function, as in a standard violin plot, but can be overridden with another function that can take x or x2 as its first argument. Stat can also be a numeric vector of the same length as x, in which case the values in this vectors are used instead of the function output and plotted against x as an independent variable.
dscale: The scale to apply to the values for density (or another plotting statistic). Defaults to 1, but adjustment may be needed depending on the scale of the plot the violin is to be added to.
cutoff: Setting for cropping the violin. Can be either a single value, in which case the input is interpreted as number of standard deviations from the mean, or a numeric vector of length 2, giving the lower and upper cutoff value directly.
horiz: Logical indicating whether to plot horizontally (defaults to TRUE) or vertically
add: Logical indicating whether to add to an existing plot (defaults to TRUE) or generate a new plot.
lim: Limits (in the dimensions of x) used for plotting, if add==FALSE. Defaults to cutoff, but can be manually set as a numeric vector of length 2, giving the lower and upper limits of the plot.
xlab: x axis label
ylab: y axis label
fill: Fill color for the plotted violin
col: Line color for the plotted violin
lwd: Line width for the plotted violin
lty: Line width for the plotted violin
na.rm: logical indicating whether to remove NA values from input data.
...: Other arguments to be passed on to function in parameter stat
Returns
A violin plot and a data.frame containing the original and modified plotting statistic and independent variable against which it is plotted.
Details
Viol provides a versatile function for generating violin plots and adding them to r base graphics. The default plotting statistic is density(), resulting in the standard violin plot. However, density can be overridden by entering any function that can take x or x2 as its first argument, or any numeric vector containing the data to be plotted, as long as this vector is the same length as x.