\HeaderA{axis.default}{Default axis annotation utilities}{axis.default}
\aliasA{xscale.components.default}{axis.default}{xscale.components.default}
\aliasA{yscale.components.default}{axis.default}{yscale.components.default}
\keyword{dplot}{axis.default}
\begin{Description}\relax
Lattice funtions provide control over how the plot axes are annotated
through a common interface.  There are two levels of control.  The
\code{xscale.components} and \code{yscale.components} arguments can be
functions that determine tick mark locations and labels given a
packet.  For more direct control, the \code{axis} argument can be a
function that actually draws the axes.  The functions documented here
are the defaults for these arguments.  They can additonally be used as
components of user written replacements.
\end{Description}
\begin{Usage}
\begin{verbatim}
xscale.components.default(lim,
                          packet.number = 0,
                          packet.list = NULL,
                          top = TRUE,
                          ...)
yscale.components.default(lim,
                          packet.number = 0,
                          packet.list = NULL,
                          right = TRUE,
                          ...)
axis.default(side = c("top", "bottom", "left", "right"),
             scales, components, as.table,
             labels = c("default", "yes", "no"),
             ticks = c("default", "yes", "no"),
             ...)

\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{lim}] the range of the data in that packet (data subset
corresponding to a combination of levels of the conditioning
variable).  The range is not necessarily numeric; e.g. for factors,
they could be character vectors representing levels, and for the
various date-time representations, they could be vectors of length 2
with the corresponding class. 
\item[\code{packet.number}] which packet (counted according to the packet
order, described in \code{\LinkA{print.trellis}{print.trellis}}) is being
processed.  In cases where all panels have the same limits, this
function is called only once (rather than once for each packet), in
which case this argument will have the value \code{0}.

\item[\code{packet.list}] list, as long as the number of packets, giving
all the actual packets.  Specifically, each component is the
list of arguments given to the panel function when and if that
packet is drawn in a panel.  (This has not yet been implemented.) 
\item[\code{top, right}] the value of the \code{top} and \code{right}
components of the result, as appropriate.  See below for
interpretation.
\item[\code{side}] on which side the axis is to be drawn.  The usual partial
matching rules apply.  
\item[\code{scales}] the appropriate component of the \code{scales} argument
supplied to the high level function, suitably standardized. 
\item[\code{components}] list, similar to those produced by
\code{xscale.components.default} and
\code{yscale.components.default}.  
\item[\code{as.table}] the \code{as.table} argument in the high level
function.  
\item[\code{labels}] whether labels are to be drawn.  By default, the rules
determined by \code{scales} are used.  
\item[\code{ticks}] whether labels are to be drawn.  By default, the rules
determined by \code{scales} are used.  
\item[\code{...}] many other arguments may be supplied, and are passed on
to other internal functions. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These functions are part of a new API introduced in lattice 0.14 to
provide the user more control over how axis annotation is done.
While the API has been designed in anticipation of use that was
previously unsupported, the implementation has initially focused on
reproducing existing capabilities, rather then test new features.  At
the time of writing, several features are unimplemented.  If you
require them, please contact the maintainer.
\end{Details}
\begin{Value}
\code{xscale.components.default} and \code{yscale.components.default}
return lists in a specific format expected by \code{axis.default}.
The exact form will be documented later.
\end{Value}
\begin{Author}\relax
Deepayan Sarkar \email{Deepayan.Sarkar@R-project.org}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{Lattice}{Lattice}},
\code{\LinkA{xyplot}{xyplot}}, 
\code{\LinkA{print.trellis}{print.trellis}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

str(xscale.components.default(c(0, 1)))

set.seed(36872)
rln <- rlnorm(100)

densityplot(rln, 
            scales = list(x = list(log = 2), alternating = 3),
            xlab = "Simulated lognormal variates",
            xscale.components = function(...) {
                ans <- xscale.components.default(...)
                ans$top <- ans$bottom
                ans$bottom$labels$labels <- parse(text = ans$bottom$labels$labels)
                ans$top$labels$labels <-
                    if (require(MASS))
                        fractions(2^(ans$top$labels$at))
                    else
                        2^(ans$top$labels$at)
                ans
            })

\end{ExampleCode}
\end{Examples}

