
Add a legend to a Mapbox GL map
add_legend.RdAdd a legend to a Mapbox GL map
Usage
add_legend(
map,
legend_title,
values,
colors,
type = c("continuous", "categorical"),
circular_patches = FALSE,
position = "top-left"
)Arguments
- map
A map object created by the
mapboxglfunction.- legend_title
The title of the legend.
- values
The values being represented on the map (either a vector of categories or a vector of stops).
- colors
The corresponding colors for the values (either a vector of colors or an interpolate function).
- type
one of "continuous" or "categorical"
- circular_patches
Logical, whether to use circular patches in the legend.
- position
The position of the legend on the map (one of "top-left", "bottom-left", "top-right", "bottom-right").