Learn R Programming

diagram (version 1.6.5)

shadowbox: adds a box with a shadow to a plot

Description

adds a box, with shadow on a plot; used for writing text

Usage

shadowbox(box.type = "rect", mid, radx, rady = radx, 
          shadow.size = 0.01, shadow.col = "grey",
          box.col = "white", lcol = "black", lwd = 1,  
          dr = 0.01, angle = 0, len = 1, nr = 5, rx = rady,
          theta = 90, ...)

Arguments

box.type

shape of the box.

mid

midpoint (x,y) of the box.

radx

horizontal radius of the box.

rady

vertical radius of the box.

shadow.size

relative size of shadow.

shadow.col

color of shadow.

box.col

fill color of the box.

lcol

line color surrounding box.

lwd

line width of line surrounding the box.

dr

if box is curved: size of segments, in radians, to draw ellipse (decrease for smoother).

angle

rotation angle, degrees.

len

if box.type="cylinder": length of the cylinder.

nr

if box.type="multi": the number of angles.

rx

if box.type="round", the radius of the rounded part.

theta

if box.type="parallel", angle of the bottom, left corner of the parallelogram, in degrees.

...

other arguments.

Details

one box is drawn, centered aroung point mid and with horizontal and vertical radiusses radx, rady.

By default, a shadow is drawn, in the right-lower corner of the box.

The shadow color and relative size is specified with shadow.col and shadow.size respectively.

shadow.size = 0 toggles off the drawing of the shadow.

the type of the box is set with box.type which can take on the values:

  • "rect": a rectangle.

  • "ellipse": an ellipse.

  • "diamond": a diamond.

  • "round": a rectangle with rounded sides.

  • "hexa": a hexagonal shape.

  • "multi": a multigonal shape; also input "nr", the number of angles.

  • "cylinder": a cylindrical shape; also input "len", the length of the cylinder.

  • "parallel": a parallelogram; ``theta'' is the angle of the bottom left corner.

the fill-color of the box is specified with box.col;

the line width and color of the box are specified with lwd and lcol

Examples

Run this code
# NOT RUN {
openplotmat(main="shadowbox")

shadowbox(box.type = "rect", mid = c(0.1, 0.5),
          rady = 0.1, radx = 0.05, angle = 25)

shadowbox(box.type = "round", mid = c(0.3, 0.5),
          rady = 0.05, radx = 0.025, angle = 90,
          shadow.col = "darkred")

shadowbox(box.type = "ellipse", mid = c(0.5, 0.5),
          rady = 0.05, radx = 0.075, box.col = "blue")
          
shadowbox(box.type = "multi", mid = c(0.8, 0.5),
          rady = 0.05, radx = 0.05, box.col = "darkblue", nr = 5)
# }

Run the code above in your browser using DataLab