Description Usage Arguments Value Author(s) Examples
boxtext
places a text given in the vector labels
onto a plot in the base graphics system and places a coloured box behind
it to make it stand out from the background.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
x |
numeric vector of x-coordinates where the text labels should be
written. If the length of |
y |
numeric vector of y-coordinates where the text labels should be written. |
labels |
a character vector specifying the text to be written. |
col.text |
the colour of the text |
col.bg |
color(s) to fill or shade the rectangle(s) with. The default
|
border.bg |
color(s) for rectangle border(s). The default |
adj |
one or two values in [0, 1] which specify the x (and optionally y) adjustment of the labels. |
pos |
a position specifier for the text. If specified this overrides any adj value given. Values of 1, 2, 3 and 4, respectively indicate positions below, to the left of, above and to the right of the specified coordinates. |
offset |
when |
padding |
factor used for the padding of the box around the text. Padding is specified in fractions of a character width. If a vector of length two is specified then different factors are used for the padding in x- and y-direction. |
cex |
numeric character expansion factor; multiplied by codepar("cex") yields the final character size. |
font |
the font to be used |
Returns the coordinates of the background rectangle(s). If multiple labels are placed in a vactor then the coordinates are returned as a matrix with columns corresponding to xleft, xright, ybottom, ytop. If just one label is placed, the coordinates are returned as a vector.
Ian Kopacka
1 2 3 4 5 6 7 8 9 | ## Create noisy background
plot(x = runif(1000), y = runif(1000), type = "p", pch = 16,
col = "#40404060")
boxtext(x = 0.5, y = 0.5, labels = "some Text", col.bg = "#b2f4f480",
pos = 4, font = 2, cex = 1.3, padding = 1)
## Vector of labels, using argument 'pos' to position right of coordinates:
boxtext(x = c(0.3, 0.1), y = c(0.6, 0.1), labels = c("some Text", "something else"), col.bg = "#b2f4f4c0", pos = 4, padding = 0.3)
## Tweak cex, font and adj:
boxtext(x = 0.2, y = 0.4, labels = "some big and bold text", col.bg = "#b2f4f4c0", adj = c(0, 0.6), font = 2, cex = 1.8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.