Creates a mapdeck legend element for when you want to manually specify a legend (using mapdeck_legend)

legend_element(
  variables,
  colours,
  colour_type = c("fill", "stroke"),
  variable_type = c("category", "gradient"),
  title = "",
  css = ""
)

Arguments

variables

variables assigned to colours

colours

vector of hex colours assigned to variables

colour_type

one of "fill" or "stroke"

variable_type

one of category (discrete) or gradient (continuous)

title

string used as the legend title

css

string of css to control appearance.

See also

Examples

l1 <- legend_element( variables = c("a","b") , colours = c("#00FF00","#FF0000") , colour_type = "fill" , variable_type = "category" , title = "my title" )