\Header{rect}{Draw a Rectangle}
\keyword{aplot}{rect}
\begin{Usage}
\begin{verbatim}
rect(xleft, ybottom, xright, ytop,
     col=NULL, border=par("fg"), lty=NULL, lwd=par("lwd"), xpd=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{xleft}] a vector (or scalar) of left x positions.
\item[\code{ybottom}] a vector (or scalar) of bottom y positions.
\item[\code{xright}] a vector (or scalar) of right x positions.
\item[\code{ytop}] a vector (or scalar) of top y positions.
\item[\code{col}] color(s) to fill the rectangle(s) with.
\item[\code{border}] color for rectangle border(s).
\item[\code{lty}] line type for borders; defaults to \code{"solid"}.
\item[\code{lwd}] width for borders.
\item[\code{xpd}] logical (\emph{``expand''}); if \code{FLASE}, everything is
clipped to the plot region.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The positions supplied, i.e., \code{xleft, ...},
are relative to the current plotting region.  If the x-axis goes from
100 to 200 then \code{xleft} must be larger than 100 and \code{xright}
must be less than 200.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{box}} for the ``standard'' box around the plot;
\code{\Link{polygon}} and \code{\Link{segments}} for flexible line
drawing.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## set up the plot region:
plot(c(100, 250), c(300, 450), type = "n",
     main = "2 x 11 rectangles; `rect(100+i,300+i,  150+i,380+i)'")
i <- 4*(0:10)
## draw rectangles with bottom left (100, 300)+i  and top right (150, 380)+i
rect(100+i, 300+i, 150+i, 380+i, col=rainbow(11, start=.7,end=.1))
rect(240-i, 320+i, 250-i, 410+i, col=heat.colors(11), lwd=i/5)
\end{ExampleCode}
\end{Examples}

