\HeaderA{arrows}{Add Arrows to a Plot}{arrows}
\keyword{aplot}{arrows}
\begin{Description}\relax
Draw arrows between pairs of points.
\end{Description}
\begin{Usage}
\begin{verbatim}
arrows(x0, y0, x1, y1, length = 0.25, angle = 30, code = 2,
       col = par("fg"), lty = par("lty"), lwd = par("lwd"),
       ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x0, y0}] coordinates of points \bold{from} which to draw.
\item[\code{x1, y1}] coordinates of points \bold{to} which to draw.
\item[\code{length}] length of the edges of the arrow head (in inches).
\item[\code{angle}] angle from the shaft of the arrow to the edge of the
arrow head.
\item[\code{code}] integer code, determining \emph{kind} of arrows to be
drawn.
\item[\code{col, lty, lwd}] graphical parameters, possible vectors.
\code{NA} values in \code{col} cause the arrow to be omitted.
\item[\code{...}] graphical parameters such as \code{xpd} and the line
characteristics \code{lend}, \code{ljoin} and \code{lmitre}:
see \code{\LinkA{par}{par}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For each \code{i}, an arrow is drawn between the point \code{(x0[i],
    y0[i])} and the point \code{(x1[i],y1[i])}.

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

The graphical parameters \code{col}, \code{lty} and \code{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.
\end{Details}
\begin{Note}\relax
The first four arguments in the comparable S function are named
\code{x1,y1,x2,y2}.
\end{Note}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{segments}{segments}} to draw segments.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
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')
\end{ExampleCode}
\end{Examples}

