.BG
.FN axis
.TL
Add an Axis to the Current Plot
.CS
axis(side, at, labels=T, ticks=T,
     distn, line=0, pos, outer=F)
.AG side
side of plot for axis (1,2,3,4 for bottom, left, top,
right).
.AG at
optional vector of positions at which the ticks and tick
labels will be plotted.  If `side' is 1 or 3, `at'
represents x-coordinates.  If `side' is 2 or 4, `at'
represents y-coordinates.  If `at' is omitted, the current
axis (as specified by the `xaxp' or `yaxp' parameters, see `par') will
be plotted.
.AG labels
optional.  If `labels' is logical, it specifies whether or
not to plot tick labels.  Otherwise, `labels' must be the
same length as `at', and `label[i]' is plotted at coordinate
`at[i]'.
.AG ticks
if `TRUE', tick marks and axis line will be plotted.
.AG distn
optional character string describing the distribution used
for transforming the axis labels.  If `dist' is "normal",
then values of `at' are assumed to be probability levels,
and the labels are actually plotted at `qnorm(at)'.  This
also implies a reasonable default set of values for argument
`at'.
.AG line
line (measured out from the plot in units of standard-sized
character heights) at which the axis line will be plotted.
Tick labels will be plotted relative to this position (as
much as the tick labels and axis line differ in graphical
parameter `mgp').
.AG pos
x- or y-coordinate position at which the axis line should be
plotted.  Labels will be on the side of the axis specified
by `side'.  If `pos' is omitted, argument `line' controls
positioning of the axis.
.AG outer
if `TRUE', the axis will be drawn in the outer margin rather than
the standard plot margin.
.GR
.EX
axis(3)  # add axis on top
axis(4,label=F)  # tick marks only on right

qqnorm(data)
axis(3,dist="normal")  # add normal probability axis at top

.ne 4
qqnorm(data,xaxt="n")   # normal prob plot, no x axis labels
probs <- c(.01, .05, .1, .9, .95, .99)
axis(1,dist="norm",at=probs,
   lab=paste(probs*100,"%"))  # add user-defined probability axis

plot(x,y,axes=F)  # scatter plot with no box or axes
axis(1,pos=0); axis(2,pos=0)  # coordinate axes through origin

plot(fahrenheit)  # time-series record of temperatures
celsius <- pretty((range(fahrenheit)-32)*5/9)
axis(side=4, at=celsius*9/5+32,lab=celsius)  # celsius at right
mtext(side=4,line=4,"Celsius")
.KW aplot
.WR
