violins {paleoDiv} | R Documentation |
Wrapper around viol() to conveniently plot multiple violins on a single plot, analogous to the behavior of boxplot()
Description
Wrapper around viol() to conveniently plot multiple violins on a single plot, analogous to the behavior of boxplot()
Usage
violins(
x,
data = NULL,
group = NULL,
horiz = FALSE,
order = NULL,
xlab = "",
ylab = "",
col = "black",
fill = "grey",
lwd = 1,
lty = 1,
dscale = 1,
xlim = NULL,
ylim = NULL,
spaces = "_",
add = FALSE,
ax = TRUE,
srt = 45,
na.rm = TRUE,
...
)
Arguments
x |
plotting statistic (numeric vector) or formula object from which a plotting statistic and grouping variable can be extracted (i.e. of form x~group) |
data |
data.frame object containing x and y |
group |
grouping variable |
horiz |
logical indicating whether to plot horizontally |
order |
order of factor levels of categorical factor |
xlab |
x axis label |
ylab |
y axis label |
col |
vector of border colors |
fill |
vector of fill colors |
lwd |
vector of line widths |
lty |
vector of line types |
dscale |
density scaling factors (numeric) to apply to individual violins |
xlim |
x limits (data limits used if NULL) |
ylim |
y limits (data limits used if NULL) |
spaces |
character string in group to replace with spaces for labels, if not NULL |
add |
logical whether to add to existing plot (default: FALSE) |
ax |
whether to plot axes |
srt |
angle for categorical axis text rotation |
na.rm |
logical indicating whether to tell viol() to remove NA values (defaults to TRUE) |
... |
other arguments to pass on to paleoDiv::viol() and plot() |
Examples
data.frame(p=rnorm(50), cat=rep(c("A","B","B","B","B"),10))->d
violins(p~cat,d)