Learn R Programming

lattice (version 0.11-8)

panel.violin: 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

synopsis

panel.violin(x, y, box.ratio = 1, horizontal = TRUE,

alpha = bar.fill$alpha, border = bar.fill$border, lty = bar.fill$lty, lwd = bar.fill$lwd, col = bar.fill$col,

varwidth = FALSE,

bw = NULL, adjust = NULL, kernel = NULL, window = NULL, width = NULL, n = 50, from = NULL, to = NULL, cut = NULL, na.rm = TRUE, ...)

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.

See Also

bwplot, density

Examples

Run this code
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)
       } )

Run the code above in your browser using DataLab