arrows                 package:base                 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 = NULL, xpd = FALSE)

_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, xpd: usual graphical parameters as in `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=2' an arrowhead is drawn at `(x0[i],y0[i])' and if
     `code=1' an arrowhead is drawn at `(x1[i],y1[i])'.  If `code=3' a
     head is drawn at both ends of the arrow.

     The graphical parameters `col' and `lty' can be used to specify a
     color and line texture for the line segments which make up the
     arrows (`col' may be a vector).

_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')

