\HeaderA{ggtile}{Grob function: tile}{ggtile}
\keyword{hplot}{ggtile}
\begin{Description}\relax
Add tiles to a plot
\end{Description}
\begin{Usage}
\begin{verbatim}ggtile(plot = .PLOT, aesthetics=list(), ..., data=NULL)\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{plot}] the plot object to modify
\item[\code{aesthetics}] named list of aesthetic mappings, see details for more information
\item[\code{...}] other options, see details for more information
\item[\code{data}] data source, if not specified the plot default will be used
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The tile grob will tile the plot surface as densly as possible, assuming
that every tile is the same size.  It is similar to \code{\LinkA{levelplot}{levelplot}}
or \code{\LinkA{image}{image}}.

Aesthetic mappings that this grob function understands:

\Itemize{
\item \code{x}:x position (required)
\item \code{y}:y position (required)
\item \code{width}:width of the rectangle
\item \code{height}:height of the rectangle
\item \code{fill}:fill colour (see \code{\LinkA{sccolour}{sccolour})}
}

These can be specified in the plot defaults (see \code{\LinkA{ggplot}{ggplot}}) or
in the \code{aesthetics} argument.  If you want to modify the position
of the points or any axis options, you will need to add a position scale to
the plot.  These functions start with \code{ps}, eg.
\code{\LinkA{pscontinuous}{pscontinuous}} or \code{\LinkA{pscategorical}{pscategorical}}

Other options:

\Itemize{
\item none
}
\end{Details}
\begin{Author}\relax
Hadley Wickham <h.wickham@gmail.com>
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{ggrect}{ggrect}}, \code{\LinkA{resolution}{resolution}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}pp <- function (n,r=4) {
x <- seq(-r*pi, r*pi, len=n)
df <- expand.grid(x=x, y=x)
df$r <- sqrt(df$x^2 + df$y^2)
df$z <- cos(df$r^2)*exp(-df$r/6)
df
}
p <- ggplot(pp(20), aes=list(x=x,y=y))
ggtile(p) #pretty useless!
ggtile(p, list(fill=z))
ggtile(p, list(height=abs(z), width=abs(z)))
ggtile(ggplot(pp(100), aes=list(x=x,y=y,fill=z)))
ggtile(ggplot(pp(100, r=2), aes=list(x=x,y=y,fill=z)))
p <- ggplot(pp(20)[sample(20*20, size=200),], aes=list(x=x,y=y,fill=z))
ggtile(p)\end{ExampleCode}
\end{Examples}

