Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

legend not adding up to the map #41

Open
paragemini opened this issue Mar 9, 2022 · 2 comments
Open

legend not adding up to the map #41

paragemini opened this issue Mar 9, 2022 · 2 comments

Comments

@paragemini
Copy link

Hello - thank you for creating the wonderful package. I am facing the issue of legend not appearing on the map

this is my code

income_3<- get_acs(geography = "tract", year = 2019, state = "17", 
                                    county = "031", table = "B19001", geometry = T, output = "wide" )

income_all <- st_transform(income_3,4326)

#getting centroids
centroid_income <- setDT(st_centroid(income_all))

pie_income <-  centroid_income %>% 
  separate( col = geometry,into = c("long","lat"), sep = ",") %>%
  mutate(long = gsub(long, pattern = "c\\(", replacement = ""),
          lat = gsub(lat, pattern = "\\)", replacement = ""))

colors_pie <- viridis_pal(alpha = 1, begin = 0, end = 1, direction = 1, 
                          option = "D")

 leaflet() %>% 
  addProviderTiles(providers$CartoDB , 
                   options = providerTileOptions(minZoom = 12)) %>%
  setView(zoom = 12, 
          lng = pie_income$long[150], 
          lat = pie_income$lat[150]) %>%
  addPolygons(data = income_all, weight = 1, fillOpacity = 0, 
              color = "black", group = "tract") %>%
   addScaleBar(position = "bottomright") %>% 
  addMinicharts( lng = pie_income$long,
                 lat = pie_income$lat,
                 width = sqrt(pie_income$Total)/2 ,
    type = "pie", colorPalette = colors_pie(10), transitionTime = 0,
    chartdata = pie_income[ , 10:19] , layerId = pie_income$GEOID, 
    legend = T) 
  
   

Map :

Rplot

when I add a layerID in an incorrect manner the legend shows up but minicharts disappear :

Rplot01

@Oliversinn
Copy link

Did you solved it? I'm facing the same problem :(

@paragemini
Copy link
Author

I am learning JS, will share in three months time. Lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants