panel.violin {lattice}R Documentation

Panel Function to create Violin Plots

Description

This is a panel function that can create a violin plot. It is typically used in a high-level call to bwplot.

Usage


panel.violin(x, y,
             box.ratio = 1,
             horizontal = TRUE,
             varwidth = FALSE,
             alpha, border, lty, lwd, col,
             ...)

Arguments

x, y numeric vector or factor. Violin plots are drawn for each unique value of y (x) if horizontal is TRUE (FALSE)
box.ratio ratio of height of a violin and inter violin space
horizontal logical. If FALSE, the plot is `transposed' in the sense that the behaviours of x and y are switched. x is now the `factor'. See documentation of bwplot for a fuller explanation.
alpha, border, lty, lwd, col graphical parameters controlling the violin. Defaults are taken from the "bar.fill" settings.
varwidth logical. If FALSE, the densities are scaled separately for each group, so that the maximum value of the density reaches the limit of the allocated space for each violin (as determined by box.ratio). If TRUE, densities across violins will have comparable scale.
... arguments passed on to density.

Details

Creates Violin plot of x for every level of y. Note that most arguments controlling the display can be supplied to the high-level (typically bwplot) call directly.

Author(s)

Deepayan Sarkar Deepayan.Sarkar@R-project.org

See Also

bwplot, density

Examples


bwplot(voice.part ~ height, singer,
       panel = function(..., box.ratio) {
           panel.violin(..., col = "transparent",
                        varwidth = FALSE, box.ratio = box.ratio)
           panel.bwplot(..., fill = NULL, box.ratio = .1)
       } )


[Package lattice version 0.11-6 Index]