leg_draw: Plot a composed map legend

View source: R/leg_draw.R

leg_drawR Documentation

Plot a composed map legend

Description

Draw a map legend with several elements.

Usage

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")
)

Arguments

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

Value

A composed legend is plotted. Nothing is returned.

Examples

# 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")

maplegend documentation built on Oct. 18, 2023, 5:10 p.m.