Skip to content

Instantly share code, notes, and snippets.

@sayloren
sayloren / vioplot2
Last active December 4, 2015 15:34 — forked from mbjoseph/vioplot2.R
Slight change to the vioplot function from Daniel Adler that plots median lines instead of points, and gives the option to plot either side of a violin rather than always both.
### Plot with different colors, edit from kory, http://stackoverflow.com/questions/14975853/how-can-i-create-violin-plot-in-different-colours
vioplot2 <- function (x, ..., range = 1.5, h = NULL, ylim = NULL, names = NULL,
horizontal = FALSE, col = "magenta", border = "black", lty = 1,
lwd = 1, rectCol = "black", colMed = "white", pchMed = 19,
at, add = FALSE, wex = 1, drawRect = TRUE, side="both")
{
datas <- list(x, ...)
n <- length(datas)
if (missing(at))