\HeaderA{contour-methods}{Contour plots for flow data}{contour.Rdash.methods}
\aliasA{contour}{contour-methods}{contour}
\aliasA{contour,ANY-method}{contour-methods}{contour,ANY.Rdash.method}
\aliasA{contour,flowFrame-method}{contour-methods}{contour,flowFrame.Rdash.method}
\aliasA{contour,flowSet-method}{contour-methods}{contour,flowSet.Rdash.method}
\keyword{methods}{contour-methods}
\begin{Description}\relax
Basic contour plots for both
\code{\LinkA{flowFrame}{flowFrame}}s and
\code{\LinkA{flowSet}{flowSet}}s. The densities for
the contours are estimated using the fast kernel density estimation
algorithm \code{\LinkA{bkde2D}{bkde2D}}.
\end{Description}
\begin{Usage}
\begin{verbatim}

## method for 'flowFrame' objects
## S4 method for signature 'flowFrame':
contour(
    x,
    y=1:2,
    nlevels=10,
    bw,
    grid.size=c(65,65),
    add=FALSE,
    xlab,
    ylab,
    lwd=1,
    lty=1,
    col=par("fg"),
    fill="transparent",
    ...)

## method for 'flowSet' objects
## S4 method for signature 'flowSet':
contour(
    x,
    y=1:2,
    add=FALSE,
    xlab,
    ylab,
    lwd=1,
    lty=1,
    col=par("fg"),
    fill="transparent",
    ...)

\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An object of class
\code{\LinkA{flowFrame}{flowFrame}} or
\code{\LinkA{flowSet}{flowSet}}. 
\item[\code{y}] Numeric or character vector of length 2 indicating the
channels to plot.
\item[\code{nlevels}] The approximate number of contour line levels, see
\code{\LinkA{contour}{contour}} for details.
\item[\code{bw}] The bandwidth factor used for the kernel density estimation,
see \code{\LinkA{bkde2D}{bkde2D}} for details.
\item[\code{grid.size}] The grid size used for the kernel density estimation,
see \code{\LinkA{bkde2D}{bkde2D}} for details.
\item[\code{add}] Logical, indicating whether contour lines should be
superimposed on an existing plot.
\item[\code{xlab, ylab}] The axis annotation.
\item[\code{lwd, lty, col, fill}] The usual plotting parameters, i.e. the
line width, line type, line color and fill color. When using a fill
color you should consider alpha blending to improve the results. 
\item[\code{...}] Parameters that are passed on to the plotting functions.
\end{ldescription}
\end{Arguments}
\begin{Section}{Methods}
\describe{


\item[x = "flowFrame"] A regular contour plot of the flow data in the
frame. It can be added on top of an existing plot using the \code{add}
argument.

\item[x = "flowSet"] Overlay of contours of densities for each
individual frame in the set. You should consider using differnt colors
and alpha blending to improve the result. This is only useful for a
very limited number of frames in a set (~5), for larger sets you
should consider a panelled lattice-type plot. Not that \code{bw},
\code{gridSize} and \code{nlevels} are passed on via the \dots
argument.

}
\end{Section}
\begin{Author}\relax
F. Hahne
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{bkde2D}{bkde2D}}, \code{\LinkA{contour}{contour}},
\code{\LinkA{flowFrame}{flowFrame}},
\code{\LinkA{flowSet}{flowSet}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

data(GvHD)

## simple contour plot
contour(GvHD[[1]])

## overlay with existing plot
plot(GvHD[[1]], c("FSC-H", "SSC-H"))
contour(GvHD[[1]], add=TRUE, col="lightgray", lty=3)

## colored contours
contour(GvHD[[1]], fill="red")
cols <- rainbow(3, alpha=0.1)
contour(GvHD[[1]], fill=cols, col=cols)

## overlay of multiple flowFrames in a flowSet
contour(GvHD[1:3], col=cols, fill=cols)

\end{ExampleCode}
\end{Examples}

