arrows               package:graphics               R Documentation

_A_d_d _A_r_r_o_w_s _t_o _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Draw arrows between pairs of points.

_U_s_a_g_e:

     arrows(x0, y0, x1, y1, length = 0.25, angle = 30, code = 2,
            col = par("fg"), lty = par("lty"), lwd = par("lwd"),
            ...)

_A_r_g_u_m_e_n_t_s:

  x0, y0: coordinates of points *from* which to draw.

  x1, y1: coordinates of points *to* which to draw.

  length: length of the edges of the arrow head (in inches).

   angle: angle from the shaft of the arrow to the edge of the arrow
          head.

    code: integer code, determining _kind_ of arrows to be drawn.

col, lty, lwd: graphical parameters, possible vectors. 'NA' values in
          'col' cause the arrow to be omitted.

     ...: graphical parameters such as 'xpd' and the line
          characteristics 'lend', 'ljoin' and 'lmitre': see 'par'.

_D_e_t_a_i_l_s:

     For each 'i', an arrow is drawn between the point '(x0[i], y0[i])'
     and the point '(x1[i],y1[i])'.

     If 'code=1' an arrowhead is drawn at '(x0[i],y0[i])' and if
     'code=2' an arrowhead is drawn at '(x1[i],y1[i])'.  If 'code=3' a
     head is drawn at both ends of the arrow.  Unless 'length = 0',
     when no head is drawn.

     The graphical parameters 'col', 'lty' and 'lwd' can be vectors of
     length greater than one and will be recycled if necessary.

     The direction of a zero-length arrow is indeterminate, and hence
     so is the direction of the arrowheads.  To allow for rounding
     error, arrowheads are omitted (with a warning) on any arrow of
     length less than 1/1000 inch.

_N_o_t_e:

     The first four arguments in the comparable S function are named
     'x1,y1,x2,y2'.

_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:

     'segments' to draw segments.

_E_x_a_m_p_l_e_s:

     x <- runif(12); y <- rnorm(12)
     i <- order(x,y); x <- x[i]; y <- y[i]
     plot(x,y, main="arrows(.) and segments(.)")
     ## draw arrows from point to point :
     s <- seq(length(x)-1)# one shorter than data
     arrows(x[s], y[s], x[s+1], y[s+1], col= 1:3)
     s <- s[-length(s)]
     segments(x[s], y[s], x[s+2], y[s+2], col= 'pink')

