Manually adding legend values in leaflet

后端 未结 1 1679
無奈伤痛
無奈伤痛 2021-01-03 04:49

I\'m plotting results from various British elections in Leaflet and ran into a bit of a problem with legends.

For the various results in the general election I\'m us

相关标签:
1条回答
  • 2021-01-03 05:01

    You could change it from a yellow->purple scale and make your own scale:

    map = map %>% addLegend("bottomright", 
      colors =c("#FFC125",  "#FFC125", "#8A4117", "#7D0552", "#571B7E"),
      labels= c("less", "","","","", "more"),
      title= "(e.g.) % voting UKIP at GE2015"
      opacity = 1)
    

    If you get the correct colors then it should look similar. Not the answer you were looking for, but it's a good workaround. Your output would look like this:

    Spend more time looking for better color transition and you could get a legend that looks similar to the yellow-purple color pallet you have up top.

    0 讨论(0)
提交回复
热议问题