Skip to contents

Add a continuous legend

Usage

add_continuous_legend(
  map,
  legend_title,
  values,
  colors,
  position = "top-left",
  unique_id = NULL
)

Arguments

map

A map object created by the mapboxgl function.

legend_title

The title of the legend.

values

The values being represented on the map (vector of stops).

colors

The colors used to generate the color ramp.

position

The position of the legend on the map (one of "top-left", "bottom-left", "top-right", "bottom-right").

unique_id

A unique ID for the legend container. Defaults to NULL.

Value

The updated map object with the legend added.