ggviolin: Violin plots.

Description Usage Arguments Details Value Author(s) References Examples

Description

Create a violin plot within the ggplot2 framework. The code for calculating violins is based on the vioplot 0.2 package.

Usage

1
ggviolin(data, x, y, bandwidth, alpha = 0.5, fill = "grey60", ...)

Arguments

data

dataset

x

factor variable

y

values

bandwidth

value for kernel density

alpha

parameter for alpha blending

fill

color or symbol to fill in violins.

...

other parameters

Details

The idea of a violin plot is, that additionally to the boxes of a boxplot, two density curves are plotted opposing each other, and the space between them is filled to create the shape of a 'violin'. As for any density estimation, a bandwidth parameter is used to control smoothness. Violin plots have been introduced by hintze.

Value

ggplot2 layer of violins

Author(s)

Heike Hofmann

References

Hintze, J. L. and R. D. Nelson (1998). Violin plots: a box plot-density trace synergism. The American Statistician, 52(2):181-4.

Examples

1
2
3
4
require(ggplot2)
data(diamonds)
ggviolin(diamonds, color, price, bandwidth=500)
ggviolin(diamonds, cut, price, bandwidth=300, fill=cut) + scale_fill_brewer(palette="Set1")

heike/ggboxplots documentation built on May 17, 2019, 3:23 p.m.