\HeaderA{title}{Plot Annotation}{title}
\keyword{aplot}{title}
\begin{Description}\relax
This function can be used to add labels to a plot.  Its first four
principal arguments can also be used as arguments in most high-level
plotting functions.  They must be of type \code{\LinkA{character}{character}} or
\code{\LinkA{expression}{expression}}. In the latter case, quite a bit of
mathematical notation is available such as sub- and superscripts,
greek letters, fractions, etc: see \LinkA{plotmath}{plotmath}
\end{Description}
\begin{Usage}
\begin{verbatim}
title(main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
      line = NA, outer = FALSE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{main}] The main title (on top) using font and size (character
expansion) \code{par("font.main")} and color
\code{par("col.main")}.
\item[\code{sub}] Sub-title (at bottom) using font and size
\code{par("font.sub")} and color \code{par("col.sub")}.
\item[\code{xlab}] X axis label using font and character expansion
\code{par("font.lab")} and color \code{par("col.lab")}.
\item[\code{ylab}] Y axis label, same font attributes as \code{xlab}.
\item[\code{line}] specifying a value for \code{line} overrides the
default placement of labels, and places them this many lines
outwards from the plot edge.
\item[\code{outer}] a logical value.  If \code{TRUE}, the titles are
placed in the outer margins of the plot.
\item[\code{...}] further graphical parameters from \code{\LinkA{par}{par}}.  Use
e.g., \code{col.main} or \code{cex.sub} instead of just \code{col}
or \code{cex}.  \code{xpd} can be used to set the clipping region:
this defaults to the figure region unless \code{outer = TRUE},
otherwise the device region and can only be increased.  \code{mgp}
controls the default placing of the axis titles.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The labels passed to \code{title} can be a character strings or
language objects (names, calls or expressions), or a list
containing the string to be plotted, and a selection of the optional
modifying graphical parameters \code{cex=}, \code{col=} and
\code{font=}.  Other objects will be coerced by
\code{\LinkA{as.graphicsAnnot}{as.graphicsAnnot}}.
\end{Details}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{mtext}{mtext}}, \code{\LinkA{text}{text}};
\code{\LinkA{plotmath}{plotmath}} for details on mathematical annotation.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
plot(cars, main = "") # here, could use main directly
title(main = "Stopping Distance versus Speed")

plot(cars, main = "")
title(main = list("Stopping Distance versus Speed", cex=1.5,
                  col="red", font=3))

## Specifying "..." :
plot(1, col.axis = "sky blue", col.lab = "thistle")
title("Main Title", sub = "sub title",
      cex.main = 2,   font.main= 4, col.main= "blue",
      cex.sub = 0.75, font.sub = 3, col.sub = "red")

x <- seq(-4, 4, len = 101)
y <- cbind(sin(x), cos(x))
matplot(x, y, type = "l", xaxt = "n",
        main = expression(paste(plain(sin) * phi, "  and  ",
                                plain(cos) * phi)),
        ylab = expression("sin" * phi, "cos" * phi), # only 1st is taken
        xlab = expression(paste("Phase Angle ", phi)),
        col.main = "blue")
axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
     labels = expression(-pi, -pi/2, 0, pi/2, pi))
abline(h = 0, v = pi/2 * c(-1,1), lty = 2, lwd = .1, col = "gray70")
\end{ExampleCode}
\end{Examples}

