Skip to content

If I'm using the automatically generated fillcolor how do I add this pallet to the legend? #80

Description

@vkentner

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions