R leaflet map - combine layer group selection with the legend?

Viewed 240

I know there are several R leaflet threads on here about showing the legend of layers only when those layers are selected using the addLayersControl command.

But my questions is slightly different a bit more about aesthetics. I have a map with several layers which correspond to different animal tracks, each with a different color. I want the user to be able to show/hide each track (using addLayersControl), and I want to show a legend of all the tracks. But instead of having a set of items in the legend, and the same set in the addLayersControl buttons, it would look a lot better with the radio buttons were COMBINED with the legend items. See below for the map I have now: Map with legend and layers separate

Does anybody know of any code that can do that?

Thanks!

0 Answers
Related