Learn R Programming

shape (version 1.3.4)

textflag: adds a filled rounded rectangular box with a text to a plot

Description

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

Usage

textflag(mid, radx, rady, rx = rady, dr = 0.01, 
         col = femmecol(100), lcol = "white", 
         bcol = lcol, lwd = 2, angle = 0, lab = NULL, 
         leftright = TRUE,...)

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; the box will be filled from left to right.
lcol
line color surrounding box.
bcol
line color to remove the ellipse from the rectangular box.
lwd
line width of line surrounding the box.
angle
rotation angle, degrees.
lab
one label or a vector string of labels to be added in box.
leftright
if TRUE then coloring is from left to right else the coloring is from bottom to top box (for angle = 0).
...
arguments passed to function text.

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.

This function is similar to function roundrect, except that coloring is from left to right.

Examples

Run this code
emptyplot()
textflag(mid = c(0.5, 0.5), radx = 0.5, rady = 0.1, 
         lcol = "white",  lab = "hello", cex = 5, font = 2:3)
 
textflag(mid = c(0.5, 0.15), radx = 0.5, rady = 0.1, 
         rx = 0.3,lcol = "black", lab = "hello 2", cex = 4, 
         font = 2, angle = 20)
  
textflag(mid = c(0.5, 0.85), radx = 0.5, rady = 0.1, rx = 0.03,
         lcol = "white", lab = "hello 3", cex = 4, font = 2, 
         leftright = FALSE)

Run the code above in your browser using DataLab