leg_draw | R Documentation |
Draw a map legend with several elements.
leg_draw(
x,
pos = "bottomright",
size = 1,
bg = "#f7f7f7",
fg = "#333333",
frame = TRUE,
frame_border = fg,
title_cex = 0.8 * size,
val_cex = 0.6 * size,
adj = c(0, 0),
mar = par("mar")
)
x |
list of legend parameters |
pos |
position of the legend. . It can be one of 'topleft', 'topright', 'right', 'bottomright', 'bottomleft' or 'left', |
size |
size of the legend; 2 means two times bigger |
bg |
background color of the legend |
fg |
foreground color of the legend |
frame |
if TRUE the legend is plotted within a frame |
frame_border |
border color of the frame |
title_cex |
size of the legend title |
val_cex |
size of the values in the legend |
adj |
adjust the postion of the legend in x and y directions. |
mar |
plot margins |
A composed legend is plotted. Nothing is returned.
# minimal example
plot.new()
plot.window(xlim = c(0, 1), ylim = c(0, 1), asp = 1)
box()
leg_comp(type = "prop", val = c(10, 50, 100)) |>
leg_comp(type = "typo", val = c("A", "B", "C")) |>
leg_draw(pos = "topright", bg = "lightblue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.