You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've looked everywhere for this answer and can't figure out a way to call the automatically generated color pallet in addGlPolygons fillcolor. I know I can define my own color pallet but what if I want to use the automatically generated color pallet with a legend?
library(mapview)
library(leaflet)
library(leafgl)
library(sf)
fran = st_cast(franconia, "POLYGON")
#> Warning in st_cast.sf(franconia, "POLYGON"): repeating attributes for all
#> sub-geometries for which they may not be constant
leaflet() %>%
addProviderTiles(provider = providers$CartoDB.DarkMatter) %>%
addGlPolygons(data = fran, fillColor ="SHAPE_AREA", popup = "NAME_ASCI") %>%
setView(lng = 10.5, lat = 49.5, zoom = 8)%>%
addLegend(colors="SHAPE_AREA", labels="SHAPE_AREA") #this is the issue
The text was updated successfully, but these errors were encountered:
Another and simpler way would be to include a legend option in the add*-functions that will automatically create the legend for the user. For numeric columns, I would still recommend using a custom palette as each unique value gets its own color and the legend will be quite long and unreadable.
This is a great solution, Thanks for the help. For my use case I need to use a numeric color pallet so I ended up just defining a custom pallet which I call in the legend. This is an amazingly useful package and I appreciate all your hard work on it!
I've looked everywhere for this answer and can't figure out a way to call the automatically generated color pallet in addGlPolygons fillcolor. I know I can define my own color pallet but what if I want to use the automatically generated color pallet with a legend?
The text was updated successfully, but these errors were encountered: