

   segments {base}                              R Documentation

   AAdddd LLiinnee SSeeggmmeennttss ttoo aa PPlloott

   DDeessccrriippttiioonn::

        Draw line segments between pairs of points.

   UUssaaggee::

        segments(x0, y0, x1, y1,
               col = par("fg"), lty = par("lty"), xpd = FALSE)

   AArrgguummeenntts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.

   col, lty, xpd: usual graphical parameters as in `par'.

   DDeettaaiillss::

        For each `i', a line segment is drawn between the point
        `(x0[i],
            y0[i])' and the point `(x1[i],y1[i])'.

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

   SSeeee AAllssoo::

        `arrows', `polygon' for slightly easier and less flexi-
        ble line drawing and `lines' for the usual polygons.

   EExxaammppllees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')

