1\name{mgp.axis}
2\alias{mgp.axis}
3\alias{mgp.axis.labels}
4\title{Draw Axes With Side-Specific mgp Parameters}
5\description{
6\code{mgp.axis} is a version of \code{axis} that uses the appropriate
7side-specific \code{mgp} parameter (see \code{\link{par}}) to account
8for different space requirements for axis labels vertical vs. horizontal
9tick marks.  \code{mgp.axis} also fixes a bug in \code{axis(2,\dots)}
10that causes it to assume \code{las=1}.
11
12\code{mgp.axis.labels} is used so that different spacing between tick
13marks and axis tick mark labels may be specified for x- and y-axes.  Use
14\code{mgp.axis.labels('default')} to set defaults. Users can set values
15manually using \code{mgp.axis.labels(x,y)} where \code{x} and \code{y}
16are 2nd value of \code{par('mgp')} to use.  Use
17\code{mgp.axis.labels(type=w)} to retrieve values, where \code{w='x'},
18\code{'y'}, \code{'x and y'}, \code{'xy'}, to get 3 \code{mgp} values
19(first 3 types) or 2 \code{mgp.axis.labels}.
20}
21\usage{
22mgp.axis(side, at = NULL, \dots,
23         mgp = mgp.axis.labels(type = if (side == 1 | side == 3) "x"
24                               else "y"),
25         axistitle = NULL)
26
27mgp.axis.labels(value,type=c('xy','x','y','x and y'))
28}
29
30\arguments{
31  \item{side,at}{see \code{\link{par}}}
32  \item{\dots}{arguments passed through to \code{\link{axis}}}
33  \item{mgp}{see \code{\link{par}}}
34  \item{axistitle}{if specified will cause \code{axistitle} to be drawn
35	on the appropriate axis as a title}
36  \item{value}{vector of values to which to set system option
37	\code{mgp.axis.labels}}
38  \item{type}{see above}
39}
40\section{Side Effects}{\code{mgp.axis.labels} stores the value in the
41  system option \code{mgp.axis.labels}}
42\value{
43  \code{mgp.axis.labels} returns the value of \code{mgp} (only the
44  second element of \code{mgp} if \code{type="xy"} or a list with
45  elements \code{x} and \code{y} if \code{type="x or y"}, each list
46  element being a 3-vector) for the
47  appropriate axis if \code{value} is not specified, otherwise it
48  returns nothing but the system option \code{mgp.axis.labels} is set.
49
50  \code{mgp.axis} returns nothing.
51}
52\author{Frank Harrell}
53\seealso{\code{\link{par}}}
54\examples{
55\dontrun{
56mgp.axis.labels(type='x')  # get default value for x-axis
57mgp.axis.labels(type='y')  # get value for y-axis
58mgp.axis.labels(type='xy') # get 2nd element of both mgps
59mgp.axis.labels(type='x and y')  # get a list with 2 elements
60mgp.axis.labels(c(3,.5,0), type='x')  # set
61options('mgp.axis.labels')            # retrieve
62
63plot(..., axes=FALSE)
64mgp.axis(1, "X Label")
65mgp.axis(2, "Y Label")
66
67}}
68\keyword{iplot}
69\keyword{dplot}
70\keyword{environment}
71