View source: R/addpoly_legend.R
addlegend_standard | R Documentation |
A function to add a legend in standard format to a leaflet map
addlegend_standard( basemap, df, pal_funct, variable, group, title, .opacity = 0.7, .data = leaflet::getMapData(basemap) )
basemap |
A leaflet basemap |
df |
A spatial dataframe with the geography stripped that provides data visualized in the polygon |
pal_funct |
A color function; e.g. leafletwrappers::color_numeric will often be approriate for numeric functions |
variable |
The variable to create a legend for from the provided dataframe, supplied as a string. |
group |
The group of the legend, supplied as a string. |
title |
The title of the legend, displayed above the legend. |
.opacity |
The opacity of the legend; defaults 0.7. |
.data |
A spatial dataframe. Defaults to the basemap dataframe; if the data being visualized is different from the dataframe used in the basemap, supply the other dataframe here |
A legend in a Leaflet map
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.