walkerke / mapgl

R interface to Mapbox GL JS v3 and Maplibre GL JS
https://walker-data.com/mapgl
Other
45 stars 3 forks source link

Quit a legend after adding it #10

Open enriquevaa opened 1 week ago

enriquevaa commented 1 week ago

I have developed a shiny app where I can switch from different layers, for example, heatmap, population, and locations. I use the function clear_layer() to quit the polygons when I switch from one layer to another; however, there's no function to remove the legend added through add_legend(), even if I add an option in the shiny app to render the map again the legend is still there.

Is there a way to remove the legend? Thanks!

walkerke commented 1 week ago

Yes, a clear_legend() function would make a lot of sense! I'll take a look at it.