highlight | R Documentation |
Draws a series of highlights (translucent rectangles) onto a base R plot.
highlight(
x = NULL,
y = NULL,
col = "#ffff00",
label = NA,
alpha = 0.2,
shrink = TRUE,
border = NA,
...
)
x |
x coordinates for highlight areas. |
y |
y coordinates for highlight areas (usually leave |
col |
fill colours for rectangles. |
label |
text labels for each rectangle. |
alpha |
opacity level (0 to 1) for rectangles. |
shrink |
if |
border |
colour for rectangle borders; |
... |
other arguments to pass on to |
x
and y
can either be: NULL
, in which case the extent
of the plotted area is used; a numeric vector, interleaved such that the
elements are interpreted as e.g.
c(x1_start, x1_end, x2_start, x2_end, ...)
; a list with two elements,
e.g. list(c(x1_start, x2_start, ...), c(x1_end, x2_end, ...))
; or a
matrix with two columns (first column "starts", second column "ends").
Arguments are recycled as needed.
## Not run:
curve(dnorm(x), 0, 4)
highlight(x = c(0, 0, 1, 3, 2, 4), label = letters[1:3], col = c("red", "blue", "purple"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.