mxmunicipio_leaflet: mxmunicipio_leaflet

Description Usage Arguments Value Examples

View source: R/leaflet.R

Description

mxmunicipio_leaflet

Usage

1
2
3
mxmunicipio_leaflet(df, pal, fillColor, popup = "", weight = 0.2,
  color = "#555555", opacity = 1, fillOpacity = 0.8, lng = -102,
  lat = 23.8, mapzoom = 5, zoom = NULL)

Arguments

df

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_mxstates.

pal

the color palette function, generated from colorNumeric(), colorBin(), colorQuantile(), or colorFactor()

fillColor

the values used to generate colors from the palette function

popup

The text to show when the user clicks on a map feature

weight

The thickness of map feature borders

color

The border color for the map features

opacity

the opacity of colors.

fillOpacity

The opacity of the colors used to fill the map features

lng

The longitude of the map center

lat

The latitude of the map center

mapzoom

The zoom level

zoom

The municipios to zoom into

Value

A leaflet map

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
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")

## End(Not run)

diegovalle/mxmaps documentation built on July 16, 2017, 6:14 p.m.