This R package can be used to easily create maps of Mexico at both the state and municipio levels. It is based on the choroplethr package and includes functions to create interactive maps using the leaflet package, map INEGI data using their API with the inegiR package, and format strings so they match the INEGI state and municipio codes. Feel free to ask for help in the discussion forum


For the moment this package is only available from github. For the development version:

mxmaps depends on the sf package which has other dependencies

Quick Example

What the data looks like:

region value
01 1425607
02 3769020
03 798447
04 928363
05 3146771
06 731391

##Basic Usage

The two basic functions of the package are mxstate_choropleth and mxmunicipio_choropleth. The data.frame that you provide to the plotting functions must have one column named region with the INEGI codes of the states or municipios and another one named value with the values to plot. You can specify a title with the title parameter and the number of buckets for the color scale with the num_color parameter. If you need a continuous scale you can set the num_colors parameter equal to 1.