\Header{axis.POSIXct}{Date and Date-time Plotting Functions}
\alias{axis.Date}{axis.POSIXct}
\alias{plot.Date}{axis.POSIXct}
\alias{plot.POSIXct}{axis.POSIXct}
\alias{plot.POSIXlt}{axis.POSIXct}
\keyword{utilities}{axis.POSIXct}
\keyword{chron}{axis.POSIXct}
\begin{Description}\relax
Functions to plot objects of classes \code{"POSIXlt"},
\code{"POSIXct"} and \code{"Date"}  representing calendar dates and times.
\end{Description}
\begin{Usage}
\begin{verbatim}
axis.POSIXct(side, x, at, format, ...)

axis.Date(side, x, at, format, ...)

## S3 method for class 'POSIXct':
plot(x, y, xlab = "", ...)

## S3 method for class 'POSIXlt':
plot(x, y, xlab = "", ...)

## S3 method for class 'Date':
plot(x, y, xlab = "", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x, at}] A date-time object.
\item[\code{y}] numeric values to be plotted against \code{x}.
\item[\code{xlab}] a character string giving the label for the x axis.
\item[\code{side}] See \code{\Link{axis}}.
\item[\code{format}] See \code{\Link{strptime}}.
\item[\code{...}] Further arguments to be passed from or to other methods,
typically graphical parameters or arguments of
\code{\Link{plot.default}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The functions plot against an x-axis of date-times.
\code{axis.POSIXct} and \code{axis.Date} work quite hard to choose
suitable time units (years, months, days, hours, minutes or seconds)
and a sensible output format, but this can be overridden by supplying
a \code{format} specification.

If \code{at} is supplied it specifies the locations of the ticks
and labels whereas if \code{x} is specified a suitable grid of labels
is chosen.
\end{Details}
\begin{SeeAlso}\relax
\link{DateTimeClasses}, \link{Dates} for details of the classes.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
res <- try(data(beav1, package = "MASS"))
if(!inherits(res, "try-error")) {
attach(beav1)
time <- strptime(paste(1990, day, time %/% 100, time %% 100),
                 "%Y %j %H %M")
plot(time, temp, type="l") # axis at 4-hour intervals.
# now label every hour on the time axis
plot(time, temp, type="l", xaxt="n")
r <- as.POSIXct(round(range(time), "hours"))
axis.POSIXct(1, at=seq(r[1], r[2], by="hour"), format="%H")
rm(time)
detach(beav1)
}

plot(.leap.seconds, 1:22, type="n", yaxt="n",
     xlab="leap seconds", ylab="", bty="n")
rug(.leap.seconds)
## or as dates
lps <- as.Date(.leap.seconds)
plot(lps, 1:22, type="n", yaxt="n", xlab="leap seconds", ylab="", bty="n")
rug(lps)

## 100 random dates in a 10-week period
random.dates <- as.Date("2001/1/1") + 70*sort(runif(100))
plot(random.dates, 1:100)
# or for a better axis labelling
plot(random.dates, 1:100, xaxt="n")
axis.Date(1, at=seq(as.Date("2001/1/1"), max(random.dates)+6, "weeks"))
\end{ExampleCode}
\end{Examples}

