axis                package:graphics                R Documentation

_A_d_d _a_n _A_x_i_s _t_o _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Adds an axis to the current plot, allowing the specification of
     the side, position, labels, and other options.

_U_s_a_g_e:

     axis(side, at = NULL, labels = TRUE, tick = TRUE, line = NA,
          pos = NA, outer = FALSE, font = NA, vfont = NULL,
          lty = "solid", lwd = 1, col = NULL, ...)

_A_r_g_u_m_e_n_t_s:

    side: an integer specifying which side of the plot the axis is to
          be drawn on.  The axis is placed as follows: 1=below, 2=left,
          3=above and 4=right.

      at: the points at which tick-marks are to be drawn.  Non-finite
          (infinite, 'NaN' or 'NA') values are omitted.  By default,
          when 'NULL', tickmark locations are computed, see Details
          below.

  labels: this can either be a logical value specifying whether
          (numerical) annotations are to be made at the tickmarks, or a
          vector of character strings to be placed at the tickpoints.

    tick: a logical value specifying whether tickmarks should be drawn

    line: the number of lines into the margin which the axis will be
          drawn.  This overrides the value of the graphical parameter
          'mgp[3]'.  The relative placing of tickmarks and tick labels
          is unchanged.

     pos: the coordinate at which the axis line is to be drawn: this
          overrides the values of both 'line' and 'mgp[3]'.

   outer: a logical value indicating whether the axis should be drawn
          in the outer plot margin, rather than the standard plot
          margin.

    font: font for text.

   vfont: vector font for text.

lty, lwd: line type, width for the axis line and the tick marks.

     col: color for the axis line and the tick marks.  The default
          'NULL' means to use 'par("fg")'.

     ...: other graphical parameters may also be passed as arguments to
          this function, particularly, 'cex.axis', 'col.axis' and
          'font.axis' for axis annotation, 'las' for
          vertical/horizontal label orientation, or 'fg' instead of
          'col', see 'par' on these.

_D_e_t_a_i_l_s:

     The axis line is drawn from the lowest to the highest value of
     'at', but will be clipped at the plot region. Only ticks which are
     drawn from points within the plot region (up to a tolerance for
     rounding error) are plotted, but the ticks and their labels may
     well extend outside the plot region.

     When 'at = NULL', pretty tick mark locations are computed
     internally (the same way 'axTicks(side)' would) from 'par("usr",
     "lab")' and 'par("xlog")' (or '"ylog"').

     Several of the graphics parameters affect the way axes are drawn.
     The vertical (for sides 1 and 3) positions of the axis and the
     tick labels are controlled by 'mgp', the size of the ticks is
     controlled by 'tck' and 'tcl' and the appearance of the tick
     labels by 'cex.axis', 'col.axis' and 'font.axis' with orientation
     controlled by 'las' (but not 'srt', unlike S which uses 'srt' if
     'at' is supplied and 'las' if it is not).

_V_a_l_u_e:

     This function is invoked for its side effect, which is to add an
     axis to an already existing plot.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'axTicks' returns the axis tick locations corresponding to
     'at=NULL'; 'pretty' is more flexible for computing pretty tick
     coordinates and does _not_ depend on (nor adapt to) the coordinate
     system in use.

_E_x_a_m_p_l_e_s:

     plot(1:4, rnorm(4), axes=FALSE)
     axis(1, 1:4, LETTERS[1:4])
     axis(2)
     box() #- to make it look "as usual"

     plot(1:7, rnorm(7), main = "axis() examples",
          type = "s", xaxt = "n", frame = FALSE, col = "red")
     axis(1, 1:7, LETTERS[1:7], col.axis = "blue")
     # unusual options:
     axis(4, col = "violet", col.axis="dark violet", lwd = 2)
     axis(3, col = "gold", lty = 2, lwd = 0.5)

