Learn R Programming

diagram (version 1.6.5)

textrect: adds lines of text in a rectangular-shaped box or in a parallelogram to a plot

Description

Adds one or more lines of text, centered around "mid" in a rectangular box, or in a paralellogram

Usage

textrect(mid, radx, rady = radx*length(lab), lwd = 1, 
         shadow.size = 0.01, adj = c(0.5, 0.5), 
         lab = "", box.col = "white", 
         lcol = "black", shadow.col = "grey", angle = 0, ...)
         
textparallel (mid, radx, rady = radx*length(lab), lwd = 1,
         shadow.size = 0.01, adj = c(0.5, 0.5),
         lab = "", box.col = "white",
         lcol = "black", shadow.col = "grey",
         angle = 0, theta = 90, ...)

Arguments

mid

midpoint (x,y) of the box.

radx

horizontal radius of the box.

rady

vertical radius of the box.

lwd

line width of line surrounding the box.

shadow.size

relative size of shadow.

adj

text adjustment.

lab

one label or a vector string of labels to be added in box.

box.col

fill color of the box.

lcol

line color surrounding box.

shadow.col

color of shadow.

angle

rotation angle, degrees.

theta

angle of the bottom, left corner of the parallelogram, in degrees.

...

other arguments passed to function textplain.

Details

see shadowbox for specifications of the rectangular box and its shadow.

See Also

textdiamond, textellipse, textempty, texthexa, textmulti, textplain, textround

Examples

Run this code
# NOT RUN {
  openplotmat(xlim = c(-0.1, 1.1), main = "textrect")
  for (i in 1:10) 
    textrect(mid = runif(2), col = i, radx = 0.1, rady = 0.1,
            lab = LETTERS[i], cex = 2)

  openplotmat(xlim = c(-0.1, 1.1), main = "textparallel")
  elpos <-coordinates (c(1, 1, 1, 1, 1))

  textparallel(mid = elpos[1,], col = 1, radx = 0.2, rady = 0.1,
            lab = "theta=20", theta = 20)
  textparallel(mid = elpos[2,], col = 1, radx = 0.2, rady = 0.1,
            lab = "theta=60", theta = 60)
  textparallel(mid = elpos[3,], col = 1, radx = 0.2, rady = 0.1,
            lab = "theta=100", theta = 100)
  textparallel(mid = elpos[4,], col = 1, radx = 0.2, rady = 0.1,
            lab = "theta=140", theta = 140)
  textparallel(mid = elpos[5,], col = 1, radx = 0.2, rady = 0.1,
            lab = "theta=170", theta = 170)
# }

Run the code above in your browser using DataLab