[ top | up ]

Draw a Rectangle

Syntax

rect(xleft, ybottom, xright, ytop, ...)

Arguments

xleft a vector (or scalar) of left x positions.
ybottom a vector (or scalar) of bottom y positions.
xright a vector (or scalar) of right x positions.
ytop a vector (or scalar) of top y positions.
... graphical parameters passed to set.pars.

Description

rect draws a rectangle (or sequence of rectangles) with the given coordinates. It is a primitive funciton used in hist. The value supplied, ie. xleft, ..., are relative to the current plotting region. If the x-axis goes from 100 to 200 then xleft must be larger than 100 and xright must be less than 200.

Examples

# set up the plot region but don't plot plot(c(100, 200), c(300, 400), type="n") # draw a rectangle with bottom left (150,320) # and top right (177,380) rect(150,320,177,380)