-
-
Save dgkeyes/a9b3122b77f80684f557e986f011d973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pal_state_pop <- colorNumeric("viridis", us_contiguous$estimate) | |
label_state <- function(state, pop){ | |
str_glue("{state} with population of {pop}") | |
} | |
us_contiguous %>% | |
leaflet() %>% | |
addPolygons(weight = 1, | |
color = "white", | |
fillColor = ~pal_state_pop(estimate), | |
fillOpacity = 1, | |
popup = ~label_state(NAME, estimate)) %>% | |
addLegend(pal = pal_state_pop, | |
values = ~estimate, | |
opacity = 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment