Choropleth Map

A choropleth map displays divided geographical areas or regions that are coloured in relation to a numeric variable. This section provides many examples build with R. It focuses on the leaflet package for interactive versions, and the ggplot2 for static ones.

Choropleth map with ggplot2

ggplot2 is my favourite way to make a static choropleth map. In this post I show how to load geoJSON geographical data, link it with a numeric variable and plot it as a choropleth. Another advantage of this method is that it allows to quickly transform your map in an interactive version with plotly (see further).

Choropleth map in base R

No specific library is needed to build a choropleth map once the geospatial object is loaded in R. The examples below explain how to build a color palette and attribute a color to each region, according to its numeric value.

Interactive choropleth map with leaflet

The leaflet package allows to build interactive map directly from R. On the following choropleth map it is possible to zoom and hover a country to gets more details about it. Read the tutorial.


Choropleth map with the cartography package.

Best R Choropleth Maps

The web is full of astonishing R charts made by awesome bloggers. The R graph gallery tries to display some of the best creations and explain how their source code works. If you want to display your work here, please drop me a word or even better, submit a Pull Request!

Related chart types

Hexbin map
Bubble map