Skip to content

Instantly share code, notes, and snippets.

@addiversitas
Last active October 24, 2020 16:12
Show Gist options
  • Save addiversitas/9afbdc7490ea3386c96d917a6831fc19 to your computer and use it in GitHub Desktop.
Save addiversitas/9afbdc7490ea3386c96d917a6831fc19 to your computer and use it in GitHub Desktop.
choropleth map
#create choropleth map
leaflet(world_spdf) %>%
addTiles() %>%
setView(lat = 0, lng = 0, zoom=2) %>%
addPolygons(
layerId = ~ISO2,
fillColor = ~colorPalette(Cases),
stroke = TRUE,
fillOpacity = 1,
color = "white",
weight = 1,
label = ~lapply(LabelText, htmltools::HTML)) %>%
addLegend(pal = colorPalette, values = covidData$Cumulative_cases, opacity=0.9, title = "Cases", position = "bottomleft")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment