violins: Plot a Series of Vioplot Violins

Description Usage Arguments Value Author(s) See Also Examples

View source: R/violins.R

Description

This is an improvment on the original vioplot function (combination of a box plot and a kernel density plot). You can now pass a list of violins and a list of colors. Optionally it also returns statistics on the distributions as well.

Usage

1
2
3
4
5
6
7
8
9
violins(x, by, range = 1.5, h = NULL, ylim = NULL, names =
                 NULL, horizontal = FALSE, col = "transparent", border
                 = "black", lty = 1, lwd = 1, rectCol = "grey50",
                 colMed = "grey80", pchMed = 19, at, add = FALSE, wex =
                 1, drawRect = TRUE, main = "", xlab = "", ylab = "",
                 connect = c("median", "mean", "hubermu", "deciles"),
                 SD.or.SE = c("SD"), connectcol = c("lightblue",
                 "cyan", "darkred", "grey"), las = 2, stats = FALSE,
                 quantiles = c(0.1, 0.9), CImed = TRUE, deciles = TRUE)

Arguments

x

list of vectors or a dataframe

by

accepts 'by' object for grouping

range

a factor to calculate the upper/lower adjacent values.

h

the height for the density estimator, if omit as explained in sm.density, h will be set to an optimum.

ylim

y limits.

names

one label, or a vector of labels for the datas must match the number of datas given.

horizontal

description of var 1.

col,border,lty,lwd

Graphical parameters for the violin passed to lines and polygon.

rectCol,colMed,pchMed

Graphical parameters to control the look of the box.

at

position of each violin. Default to 1:n

add

logical. if FALSE (default) a new plot is created

wex

relative expansion of the violin.

drawRect

logical. the box is drawn if TRUE.

main

main title for the plot.

connect

connects a violin plot series at the medians with line segments

connectcol

line color of the median connecting line segments

xlab

x axis label

ylab

y axis label

stats

print out statistics

SD.or.SE

Boolean for standard deviation or standard error

las

axis tick mark labels orientation

quantiles

map any pair of quantiles (as dotted box) in addition to Q1 & Q3, but are not shown when "c(0,0)" and arg is passed to descriptive stats when 'stats'=TRUE

CImed

portrays 95 percent confidence intervals for the median (as solid box)

deciles

maps deciles 0.1:0.9 (as thin lines) independently of 'quantiles' and can be connected when 2 or more variables are plotted.

Value

a series of violin plots

Author(s)

Daniel Adler <[email protected]>, David Schruth, Dave McArthur <[email protected]>

See Also

vioplot(vioplot), sm.density

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
n <- rnorm(130, 10, 3)
p <- rpois(110, 4)
u <- runif(300, 0, 20)
l <- rlnorm(130, log(2))
g <- rgamma(140, 3)
e <- rexp(160)

violins(list(e=e, p=p,u=u,n=n,l=l,g=g), ylim=c(0,20),
         col=c('purple','lightblue','lightgreen','red','orange','yellow'),
         stats=TRUE)

caroline documentation built on May 29, 2017, 12:09 p.m.

Related to violins in caroline...