addlegend_standard: Add leaflet legend

View source: R/addpoly_legend.R

addlegend_standardR Documentation

Add leaflet legend

Description

A function to add a legend in standard format to a leaflet map

Usage

addlegend_standard(
  basemap,
  df,
  pal_funct,
  variable,
  group,
  title,
  .opacity = 0.7,
  .data = leaflet::getMapData(basemap)
)

Arguments

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

Value

A legend in a Leaflet map


dpowerstp/leafletwrappers documentation built on Sept. 4, 2022, 10:19 a.m.