mlegend | R Documentation |
Stack multiple legends.
mlegend(x, y = NULL, legend, horizontal = FALSE, ...)
x , y |
the x- and y-coordinates to be used or a keyword, see
|
legend |
a list or list of lists of arguments passed to
|
horizontal |
logical; if |
... |
additional arguments passed to all legends, e.g., to set
defaults; these will be over-ridden in individual legends by passing a
list of arguments to |
A data frame of data.frame(legend(...))
for each legend
with
the legend index to distinguish multiple legends. Note that the number of
rows in each group depends on the number of values in each legend.
op <- par(mfrow = c(1, 2))
plot(1)
l <- list(
legend = 'first\nlegend', fill = 'red'
)
mlegend('topleft', legend = l)
l <- list(
l,
list(
legend = 'second legend', fill = 'blue'
),
list(
legend = letters[1:5], pch = 16, col = 1:5, bty = 'n'
),
list(
legend = LETTERS[1:3], horiz = TRUE, lty = 1, col = 1:3
),
list(
legend = 'final legend'
)
)
mlegend('left', legend = l, horizontal = TRUE)
## dot arguments will be applied to all legends
mlegend('topright', legend = l, bty = 'n', inset = c(-0.5, 0), xpd = NA)
par(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.