Is there a mechanism for adding legends for for polygon outlines? I can map hollow polygon outlines by altering the color field and specifying fillOpacity=0 in my addPolygons() call, however I can achieve the same functionality when I addLegend() to the map? Example of hollow polygons and filled legend below:
library(sf)
library(leaflet)
library(tidyverse)
demo(nc, ask = FALSE, echo = FALSE)
nc_pal <- colorFactor(palette = "inferno", domain = nc$Name)
nc <- st_transform(nc, 4326)
leaflet(nc) %>%
addProviderTiles(provider = c("Esri.WorldTopoMap"),
group = "Esri.WorldTopoMap") %>%
addPolygons(
data = nc,
group = "nc",
color = ~ nc_pal(NAME),
fillOpacity = 0
) %>%
addLegend(
data = nc,
group = "nc",
colors = ~ nc_pal(NAME),
labels = ~ NAME
)