\HeaderA{contourLines}{Calculate Contour Lines}{contourLines}
\keyword{dplot}{contourLines}
\begin{Description}\relax
Calculate contour lines for a given set of data.
\end{Description}
\begin{Usage}
\begin{verbatim}
contourLines(x = seq(0, 1, length.out = nrow(z)),
             y = seq(0, 1, length.out = ncol(z)),
             z, nlevels = 10,
             levels = pretty(range(z, na.rm=TRUE), nlevels))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x,y}] locations of grid lines at which the values in \code{z} are
measured.  These must be in ascending order.  By default, equally
spaced values from 0 to 1 are used.  If \code{x} is a \code{list},
its components \code{x\$x} and \code{x\$y} are used for \code{x}
and \code{y}, respectively. If the list has component \code{z} this
is used for \code{z}.
\item[\code{z}] a matrix containing the values to be plotted (\code{NA}s are
allowed).  Note that \code{x} can be used instead of \code{z} for
convenience.
\item[\code{nlevels}] number of contour levels desired \bold{iff}
\code{levels} is not supplied.
\item[\code{levels}] numeric vector of levels at which to draw contour
lines.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{contourLines} draws nothing, but returns a set of contour lines.

There is currently no documentation about the algorithm.
The source code is in \file{\var{\LinkA{R\_HOME}{R.Rul.HOME}}/src/main/plot3d.c}.
\end{Details}
\begin{Value}
A list of contours.
Each contour is a list with elements:
\begin{ldescription}
\item[\code{level }] The contour level.
\item[\code{x }] The x-coordinates of the contour.
\item[\code{y }] The y-coordinates of the contour.
\end{ldescription}
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{options}{options}("max.countour.segments")} for the maximal
complexity of a single contour line.

\code{\LinkA{contour}{contour}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)
contourLines(x, y, volcano)
\end{ExampleCode}
\end{Examples}

