The R Project SVN R

Rev

Rev 61153 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61168
Line 29... Line 29...
29
\description{
29
\description{
30
  Draw arrows between pairs of points.
30
  Draw arrows between pairs of points.
31
}
31
}
32
\details{
32
\details{
33
  For each \code{i}, an arrow is drawn between the point \code{(x0[i],
33
  For each \code{i}, an arrow is drawn between the point \code{(x0[i],
34
    y0[i])} and the point \code{(x1[i],y1[i])}.  The coordinate vectors
34
    y0[i])} and the point \code{(x1[i], y1[i])}.  The coordinate vectors
35
  will be recycled to the length of the longest.
35
  will be recycled to the length of the longest.
36
 
36
 
37
  If \code{code = 1} an arrowhead is drawn at \code{(x0[i],y0[i])} and if
37
  If \code{code = 1} an arrowhead is drawn at \code{(x0[i], y0[i])} and if
38
  \code{code = 2} an arrowhead is drawn at \code{(x1[i],y1[i])}.  If
38
  \code{code = 2} an arrowhead is drawn at \code{(x1[i], y1[i])}.  If
39
  \code{code = 3} a head is drawn at both ends of the arrow.  Unless
39
  \code{code = 3} a head is drawn at both ends of the arrow.  Unless
40
  \code{length = 0}, when no head is drawn.
40
  \code{length = 0}, when no head is drawn.
41
 
41
 
42
  The \link{graphical parameters} \code{col}, \code{lty} and \code{lwd}
42
  The \link{graphical parameters} \code{col}, \code{lty} and \code{lwd}
43
  can be vectors of length greater than one and will be recycled if
43
  can be vectors of length greater than one and will be recycled if
Line 56... Line 56...
56
}
56
}
57
\seealso{
57
\seealso{
58
  \code{\link{segments}} to draw segments.
58
  \code{\link{segments}} to draw segments.
59
}
59
}
60
\note{The first four arguments in the comparable S function are named
60
\note{The first four arguments in the comparable S function are named
61
  \code{x1,y1,x2,y2}.
61
  \code{x1, y1, x2, y2}.
62
}
62
}
63
\examples{
63
\examples{
64
x <- stats::runif(12); y <- stats::rnorm(12)
64
x <- stats::runif(12); y <- stats::rnorm(12)
65
i <- order(x,y); x <- x[i]; y <- y[i]
65
i <- order(x, y); x <- x[i]; y <- y[i]
66
plot(x,y, main = "arrows(.) and segments(.)")
66
plot(x,y, main = "arrows(.) and segments(.)")
67
## draw arrows from point to point :
67
## draw arrows from point to point :
68
s <- seq(length(x)-1)# one shorter than data
68
s <- seq(length(x)-1)  # one shorter than data
69
arrows(x[s], y[s], x[s+1], y[s+1], col = 1:3)
69
arrows(x[s], y[s], x[s+1], y[s+1], col = 1:3)
70
s <- s[-length(s)]
70
s <- s[-length(s)]
71
segments(x[s], y[s], x[s+2], y[s+2], col = 'pink')
71
segments(x[s], y[s], x[s+2], y[s+2], col = "pink")
72
}
72
}
73
\keyword{aplot}
73
\keyword{aplot}