Zoomable municipio maps made with leaflet
mxmunicipio_leaflet(
df,
pal,
fillColor,
popup = "",
weight = 0.2,
color = "#555555",
opacity = 0.8,
fillOpacity = 0.8,
lng = -102,
lat = 23.8,
mapzoom = 5,
zoom = NULL
)
A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how regions are named in the "region" column in ?df_mxmunicipio.
the color palette function, generated from
colorNumeric()
, colorBin()
, colorQuantile()
, or
colorFactor()
the values used to generate colors from the palette function
The text to show when the user clicks on a map feature
The thickness of map feature borders
The border color for the map features
the opacity of colors.
The opacity of the colors used to fill the map features
The longitude of the map center
The latitude of the map center
The zoom level
The municipios to zoom into
A leaflet map
if (FALSE) {
library(leaflet)
data(df_mxmunicipio)
df_mxmunicipio$value <- df_mxmunicipio$indigenous /df_mxmunicipio$pop
magma <- c("#000004FF", "#1D1146FF", "#50127CFF", "#822681FF",
"#B63779FF", "#E65163FF", "#FB8761FF", "#FEC387FF", "#FCFDBFFF")
pal <- colorNumeric(magma, domain = df_mxmunicipio$value)
mxmunicipio_leaflet(df_mxmunicipio,
pal,
~ pal(value),
~ sprintf("State: %s<br/>Municipio : %s<br/>Value: %s%%",
state_name, municipio_name, round(value * 100, 1))) %>%
addLegend(position = "bottomright", pal = pal,
values = df_mxmunicipio$value) %>%
addProviderTiles("CartoDB.Positron")
}