\HeaderA{lattice-methods}{Methods implementing Lattice displays for flow data}{lattice.Rdash.methods}
\aliasA{densityplot}{lattice-methods}{densityplot}
\aliasA{densityplot,formula,flowSet-method}{lattice-methods}{densityplot,formula,flowSet.Rdash.method}
\aliasA{levelplot}{lattice-methods}{levelplot}
\aliasA{levelplot,formula,flowSet-method}{lattice-methods}{levelplot,formula,flowSet.Rdash.method}
\aliasA{panel.densityplot.flowset}{lattice-methods}{panel.densityplot.flowset}
\aliasA{parallel}{lattice-methods}{parallel}
\aliasA{parallel,flowFrame,missing-method}{lattice-methods}{parallel,flowFrame,missing.Rdash.method}
\aliasA{parallel,formula,flowSet-method}{lattice-methods}{parallel,formula,flowSet.Rdash.method}
\aliasA{prepanel.densityplot.flowset}{lattice-methods}{prepanel.densityplot.flowset}
\aliasA{qqmath}{lattice-methods}{qqmath}
\aliasA{qqmath,formula,flowSet-method}{lattice-methods}{qqmath,formula,flowSet.Rdash.method}
\keyword{methods}{lattice-methods}
\keyword{dplot}{lattice-methods}
\begin{Description}\relax
Various methods implementing multipanel visualizations for flow data
using infrastructure provided in the lattice package.  The original
generics for these methods are defined in lattice, and these S4
methods (mostly) dispatch on a formula and the \code{data} argument
which must be of class \code{flowSet} or \code{flowFrame}.  The formula
has to be fairly basic: conditioning can be done using phenodata
variables and channel names (the \code{colnames} slot) can be used as
panel variables.  In the case of the \code{densityplot} method, a
phenodata variable must be used on the left hand side of the formula
as a panel variable to stack the densities.  See examples below for
sample usage.
\end{Description}
\begin{Usage}
\begin{verbatim}

## methods for 'flowSet' objects

## S4 method for signature 'formula, flowSet':
densityplot(x, data, 
            xlab, as.table = TRUE, overlap = 0.3,
            prepanel = prepanel.densityplot.flowset,
            panel = panel.densityplot.flowset,
            ...)

## S4 method for signature 'formula, flowSet':
qqmath(x, data, xlab, ylab,
       f.value = function(n) ppoints(ceiling(sqrt(n))),
       distribution = qnorm, ...)

## S4 method for signature 'formula, flowSet':
levelplot(x, data, xlab, ylab,
          as.table = TRUE, contour = TRUE, labels = FALSE,
          n = 50, ...)

## methods for 'flowFrame' objects

## S4 method for signature 'flowFrame, missing':
parallel(x, data, 
         reorder.by = function(x) var(x, na.rm = TRUE),
         time = "Time", exclude.time = TRUE,
         ...)

\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a formula describing the structure of the plot and the
variables to be used in the display.   
\item[\code{data}] a \code{flowSet} object that serves as a source of data 
\item[\code{xlab, ylab}] Labels for data axes, with suitable defaults taken
from the formula 
\item[\code{overlap}] the amount of overlap between stacked density plots 
\item[\code{prepanel}] the prepanel function.  See
\code{\LinkA{xyplot}{xyplot}} 
\item[\code{panel}] the panel function.  See
\code{\LinkA{xyplot}{xyplot}} 
\item[\code{f.value, distribution}] number of points used in Q-Q plot, and
the reference distribution used.  See
\code{\LinkA{qqmath}{qqmath}} for details.  
\item[\code{n}] the number of bins on each axis to be used when evaluating
the density 
\item[\code{as.table, contour, labels}] These
arguments are passed unchanged to the corresponding methods in
lattice, and are listed here only because they provide different
defaults.  See documentation for the original methods for details.

\item[\code{time}] A character string giving the name of the column
recording time. 
\item[\code{exclude.time}] logical, specifying whether to exclude the time
variable from a scatter plot matrix or parallel coordinates plot.
It is rarely meaningful not to do so. 
\item[\code{reorder.by}] a function, which is applied to each column.  The
columns are ordered by the results.  Reordering can be suppressed by
setting this to \code{NULL}.  
\item[\code{...}] more arguments, usually passed on to the underlying
lattice methods. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Not all standard lattice arguments will have the intended
effect, but many should.  For a fuller description of possible
arguments and their effects, consult documentation on lattice (Trellis
docs would also work for the fundamentals).
\end{Details}
\begin{Section}{Methods}
\describe{

\item[densityplot] \code{signature(x = "formula", data =
        "flowSet")}: creates density plots for a given channel, with
samples stacked according to a phenodata variable.  Colors are
used to indicate common values of this covariate across panels.


\item[qqmath] \code{signature(x = "formula", data = "flowSet")}:
creates theoretical quantile plots of a given channel, with one or
more samples per panel


\item[levelplot] \code{signature(x = "formula", data = "flowSet")}:
similar to the \code{xyplot} method, but plots estimated density
(using \code{\LinkA{kde2d}{kde2d}}) with a common z-scale and
an optional color key.


\item[parallel] \code{signature(x = "flowFrame", data = "missing")}:
draws a parallel coordinates plot of all channels (excluding time,
by default) of a \code{flowFrame} object.  This is rarely useful
without transparency, but that is currently only possible with the
\code{\LinkA{pdf}{pdf}} device (and perhaps the aqua device as well).


}
\end{Section}
\begin{Examples}
\begin{ExampleCode}

data(GvHD)

densityplot(Visit ~ `FSC-H` | Patient, GvHD)

densityplot(Visit ~ asinh(`FSC-H`) | Patient, GvHD,
            panel = function(...) {
                ylim <- current.panel.limits()$ylim
                v <- c(5.5, 7)
                panel.rect(v[1], ylim[1],
                           v[2], ylim[2],
                           col = "grey")
                panel.densityplot.flowset(...)
            })

qqmath( ~ `FSC-H` | factor(Patient), GvHD,
       grid = TRUE, type = "l",
       f.value = ppoints(100))

## contourplot of bivariate density:

require(colorspace)
YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")
colori <- colorRampPalette(YlOrBr)
levelplot(asinh(`SSC-H`) ~ asinh(`FSC-H`) | Visit + Patient, GvHD, n = 20,
          col.regions = colori(50), main = "Contour Plot")


## parallel coordinate plots

parallel(GvHD[["s6a01"]])

## Not run: 

## try with PDF device
parallel(GvHD[["s7a01"]], alpha = 0.01)

## End(Not run)

\end{ExampleCode}
\end{Examples}

