\HeaderA{panel.violin}{Panel Function to create Violin Plots}{panel.violin}
\keyword{dplot}{panel.violin}
\begin{Description}\relax
This is a panel function that can create a violin plot.  It is
typically used in a high-level call to \code{bwplot}.
\end{Description}
\begin{Usage}
\begin{verbatim}

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

\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x, y}] numeric vector or factor. Violin plots are drawn for each unique
value of \code{y} (\code{x}) if \code{horizontal} is \code{TRUE}
(\code{FALSE})

\item[\code{box.ratio}] ratio of height of a violin and inter violin space

\item[\code{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 \code{bwplot} for a fuller explanation.

\item[\code{alpha, border, lty, lwd, col}] graphical parameters controlling the violin.  Defaults are taken
from the \code{"bar.fill"} settings.

\item[\code{varwidth}] logical. If \code{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
\code{box.ratio}).  If \code{TRUE}, densities across violins will
have comparable scale.

\item[\code{...}] arguments passed on to \code{density}.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Creates Violin plot of \code{x} for every level of \code{y}. Note that
most arguments controlling the display can be supplied to the
high-level (typically \code{bwplot}) call directly.
\end{Details}
\begin{Author}\relax
Deepayan Sarkar \email{Deepayan.Sarkar@R-project.org}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{bwplot}{bwplot}}, \code{\LinkA{density}{density}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

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)
       } )

\end{ExampleCode}
\end{Examples}

