textbox.Rd
Add text to plot, justified, in a box
x position: a vector with min. and max. x-position
y position: location of the top of the box
a vector of text strings
x alignment: 'l'=left, 'c'=center, 'r'=right.
character expansion
inter-line spacing
whether to draw a box around the text
adjustment for x and y position, default is no adjustment, see Details
text font, see Details
text font, see Details
text color
box border color
box fill color
box shading line density, see Details
box shading line angle, see Details
box border and shading line types, see Details
box border and shading line width, see Details
amount to adjust box border in or out. See Details
Draws text in the box by pasting the textlist vector together, splitting it into words, and then adding words to the current line until the line is wide enough before moving on to the next line.
margin may be a vector of 1, 2, or 4 values, corresponding to adjustment of all borders (1 value), top/bottom and left/right borders (2 values), or bottom/left/top/right borders (4 values). A positive value moves text inwards from specified (x,y) position with border remaining at (x,y), and a negative value moves the border outwards from (x,y) with the text remaining at (x,y).
The density and angle arguments have the same behavior as in the rect function. The adj, font and vfont arguments have the same behavior as in the text function. The lty and lwd arguments have the same behavior as in the lines function.
y-position of bottom line of box, or y-position of next line if there is no box.
plot.new()
textbox(c(0,0.2), 1, c("many words","more words","why not?",
"keep going",rep("and going",10)))
#> [1] 1.0000000 0.9624302 0.9248605 0.8872907 0.8497209 0.8121512 0.7745814
#> [8] 0.7370116 0.6994419 0.6618721 0.6243023 0.5867326 0.5491628 0.5115930
#> [15] 0.4740233
textbox(c(0.3,0.5), 1, c("keep going",rep("and going",10)), cex=0.45,
col="blue", border="red", fill="#00FFEE80", density=25, angle=60)
#> [1] 1.0000000 0.9843459 0.9686919 0.9530378 0.9373837
textbox(c(0.6,0.8), 1, c("keep going",rep("and going",10)), justify='c', cex=0.6,
leading=1, font=4, border="gold", lty=2, lwd=4, margin=0.025)
#> [1] 0.9750000 0.9457791 0.9165581 0.8873372 0.8581163 0.8288953 0.7996744
#> [8] 0.7704535 0.7412326
textbox(c(0.6,0.8), 0.5, c("keep going",rep("and going",10)), justify='r', cex=0.7,
col="purple", font=3, border="green", margin=-0.025)
#> [1] 0.5000000 0.4749535 0.4499070 0.4248605 0.3998140 0.3747674 0.3497209
lines(c(0,1), c(1,1), col="red", lty=2)
lines(c(0,1), c(0.5,0.5), col="red", lty=2)