Wrapper around viol() to conveniently plot multiple violins on a single plot, analogous to the behavior of boxplot()
violins(
x,
data = NULL,
group = NULL,
wt = NULL,
adjustto1 = TRUE,
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,
adj = c(1, 0),
na.rm = TRUE,
...
)
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.frame object containing x and y
grouping variable
optional vector of weights (default=NULL)
optional setting whether to adjust weights in each category to sum to 1 (default=TRUE)
logical indicating whether to plot horizontally
order of factor levels of categorical factor
x axis label
y axis label
vector of border colors
vector of fill colors
vector of line widths
vector of line types
density scaling factors (numeric) to apply to individual violins
x limits (data limits used if NULL)
y limits (data limits used if NULL)
character string in group to replace with spaces for labels, if not NULL
logical whether to add to existing plot (default: FALSE)
whether to plot axes
angle for categorical axis text rotation
adjustment for axis labels (defaults to c(1,0), i.e. top right)
logical indicating whether to tell viol() to remove NA values (defaults to TRUE)
other arguments to pass on to paleoDiv::viol() and plot()
data.frame(p=rnorm(50), cat=rep(c("A","B","B","B","B"),10))->d
violins(p~cat,d)
Run the code above in your browser using DataLab