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.
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!