Learn R Programming

shape (version 1.3.4)

roundrect: adds a rounded rectangular box to a plot

Description

adds a rectangular box with rounded left and right edges to a plot

Usage

roundrect(mid, radx, rady, rx = rady, dr = 0.01, 
          col = "white", lcol = "black", lwd = 2, angle = 0, ...)

Arguments

mid
midpoint (x,y) of the box.
radx
horizontal radius of the box.
rady
vertical radius of the box.
rx
radius of rounded part.
dr
size of segments, in radians, to draw the rounded line (decrease for smoother).
col
fill color of the box.
lcol
line color surrounding box.
lwd
line width of line surrounding the box.
angle
rotation angle, degrees.
...
arguments passed to function filledshape.

Details

radx and rady are the horizontal and vertical radiusses of the box; rx is the horizontal radius of the rounded part.

Here horizontal and vertical denote the position BEFORE rotation.

Examples

Run this code
emptyplot(c(-0.1, 1.1), main = "roundrect")
for (i in 1:10) 
  roundrect(mid = runif(2), col = i, radx = 0.1, rady = 0.05)
for (i in 1:5)
  roundrect(mid = runif(2), col = greycol(20), radx = 0.05,
            rady = 0.05, angle = runif(1)*360)

Run the code above in your browser using DataLab