\HeaderA{panel.xyplot}{Default Panel Function for xyplot}{panel.xyplot}
\aliasA{panel.qq}{panel.xyplot}{panel.qq}
\aliasA{panel.splom}{panel.xyplot}{panel.splom}
\keyword{dplot}{panel.xyplot}
\begin{Description}\relax
This is the default panel function for \code{xyplot}. Also see
\code{panel.superpose}.  The default panel functions for
\code{splom} and \code{qq} are essentially the same function.
\end{Description}
\begin{Usage}
\begin{verbatim}
panel.xyplot(x, y, type = "p",
             groups = NULL,
             pch, col, col.line, col.symbol,
             font, fontfamily, fontface,
             lty, cex, fill, lwd,
             horizontal = FALSE, ...,
             jitter.x = FALSE, jitter.y = FALSE,
             factor = 0.5, amount = NULL)
panel.splom(...)
panel.qq(...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x,y}] variables to be plotted in the scatterplot
\item[\code{type}] character vector consisting of one or more of the
following: \code{"p"}, \code{"l"}, \code{"h"}, \code{"b"},
\code{"o"}, \code{"s"}, \code{"S"}, \code{"r"}, \code{"a"},
\code{"g"}, \code{"smooth"}.  If type has more than one element, an
attempt is made to combine the effect of each of the components.

The behaviour if any of the first six are included in \code{type} is
similar to the effect of \code{type} in \code{\LinkA{plot}{plot}} (type
\code{"b"} is actually the same as \code{"o"}).  \code{"r"} adds a
regression line (same as \code{\LinkA{panel.lmline}{panel.lmline}}, except for
default graphical parameters), and \code{"smooth"} adds a lowess fit
(same as \code{\LinkA{panel.loess}{panel.loess}}).  \code{"g"} adds a reference
grid using \code{\LinkA{panel.grid}{panel.grid}} in the background.  \code{"a"}
has the effect of calling \code{\LinkA{panel.linejoin}{panel.linejoin}}, which can be
useful for creating interaction plots.  The effect of several of
these specifications depend on the value of \code{horizontal}.

Type \code{"s"} (and \code{"S"}) sorts the values along one of the
axes (depending on \code{horizontal}); this is unlike the behavior
in \code{plot}.  For the latter behavior, use \code{type = "s"} with
\code{panel = panel.points}.

See \code{example(xyplot)} and \code{demo(lattice)} for examples.

\item[\code{groups}] an optional grouping variable.  If present,
\code{\LinkA{panel.superpose}{panel.superpose}} will be used instead to display each
subgroup 
\item[\code{col, col.line, col.symbol}] default colours are obtained from \code{plot.symbol} and
\code{plot.line} using \code{\LinkA{trellis.par.get}{trellis.par.get}}.

\item[\code{font, fontface, fontfamily}] font used when \code{pch} is a character

\item[\code{pch, lty, cex, lwd, fill}] other graphical parameters.  \code{fill} serves the purpose of
\code{bg} in \code{\LinkA{points}{points}} for certain values of \code{pch}

\item[\code{...}] extra arguments, if any, for \code{panel.xyplot}. In
most cases \code{panel.xyplot} ignores these. For types "r" and
"smooth", these are passed on to \code{panel.lmline} and
\code{panel.loess} respectively.

\item[\code{horizontal}] logical. Controls orientation for certain
\code{type}'s, e.g.  one of \code{"h"}, \code{"s"} or \code{"S"}
\item[\code{jitter.x, jitter.y}] logical, whether the data should be
jittered before being plotted. 
\item[\code{factor, amount}] controls amount of jittering. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Creates scatterplot of \code{x} and \code{y}, with various
modifications possible via the type argument. \code{panel.qq} draws a
45 degree line before calling \code{panel.xyplot}.

Note that most of the arguments controlling the display can be
supplied directly to the high-level (e.g. \code{\LinkA{xyplot}{xyplot}}) call.
\end{Details}
\begin{Author}\relax
Deepayan Sarkar \email{Deepayan.Sarkar@R-project.org}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{panel.superpose}{panel.superpose}},
\code{\LinkA{xyplot}{xyplot}},
\code{\LinkA{splom}{splom}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

types.plain <- c("p", "l", "o", "r", "g", "s", "S", "h", "a", "smooth")
types.horiz <- c("s", "S", "h", "a", "smooth")
horiz <- rep(c(FALSE, TRUE), c(length(types.plain), length(types.horiz)))

types <- c(types.plain, types.horiz)

x <- sample(seq(-10, 10, length.out = 15), 30, TRUE)
y <- x + 0.25 * (x + 1)^2 + rnorm(length(x), sd = 5)

xyplot(y ~ x | gl(1, length(types)),
       xlab = "type", 
       ylab = list(c("horizontal=TRUE", "horizontal=FALSE"), y = c(1/6, 4/6)),
       as.table = TRUE, layout = c(5, 3),
       between = list(y = c(0, 1)),
       strip = function(...) {
           panel.fill(trellis.par.get("strip.background")$col[1])
           type <- types[panel.number()]
           grid::grid.text(label = sprintf('"%s"', type), 
                           x = 0.5, y = 0.5)
           grid::grid.rect()
       },
       scales = list(alternating = c(0, 2), tck = c(0, 0.7), draw = FALSE),
       par.settings = 
       list(layout.widths = list(strip.left = c(1, 0, 0, 0, 0))),
       panel = function(...) {
           type <- types[panel.number()]
           horizontal <- horiz[panel.number()]
           panel.xyplot(..., 
                        type = type,
                        horizontal = horizontal)
       })[rep(1, length(types))]

\end{ExampleCode}
\end{Examples}

