shadowtext | R Documentation |
This is similar to the text function, but it also puts a background shadow (outline) behind the text to make it stand out from the background better.
shadowtext(x, y = NULL, labels, col = "white", bg = "black",
theta = seq(pi/32, 2 * pi, length.out = 64), r = 0.1,
cex = 1, ...)
x |
x-coordinates for the text |
y |
y-coordinates for the text |
labels |
The text labels to plot |
col |
Color of the text |
bg |
Color of the background shadow |
theta |
Angles for plotting the background |
r |
Thickness of the shadow relative to plotting size |
cex |
Character expansion passed through to |
... |
Additional arguments passed on to |
When adding text to a plot it is possible that the color of the text may make it difficult to see relative to its background. If the text spans different backgrounds then it may not be possible to find a single color to give proper contrast.
This function creates a contrasting shadow for the text by first
plotting several copies of the text at angles theta
and
distance r
in the background color, then plotting the text on
top.
This gives a shadowing or outlining effect to the text making it easier to read on any background.
This function is run for its side effects, returns NULL.
Greg Snow, 538280@gmail.com, with improvements by Thomas Danhorn
text
plot(1:10, 1:10, bg='aliceblue')
rect(3,3,5,8, col='navy')
text(5,6, 'Test 1', col='lightsteelblue')
shadowtext(5,4, 'Test 2', col='lightsteelblue')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.