Create and integrate maps in your R workflow with the cartography package

The cartography package allows various cartographic representations such as proportional symbols, chroropleth, typology, flows or discontinuities. In addition it also proposes some useful features like cartographic palettes, layout (scale, north arrow, title…), labels, legends or access to cartographic API to ease the graphic presentation of maps.

Hereunder you will see some maps generated with this package. Main mobilized functions are highlighted below each map.

All scripts used in designing the maps are coming from the package vignette.
Base maps and data on European regions are part of the package.
Click on a map to enlarge.

Proportional Symbols

The propSymbolsLayer function displays proportional circles.
getTiles and tilesLayer functions are used to display the OpenStreetMap tiles.

Choropleth Map

This map uses the choroLayer function.
Colors were selected via the carto.pal function that proposes a set of cartographic palettes.

Stock & Ratio

The propSymbolsChoroLayer function plots a proportional symbols layer with colors based on a quantitative data discretization. Main discretization methods are available (sd, equal, quantile, jenks…).

Label Map


The labelLayer function places labels on a map. Size, position and aspect of the labels can be set.

Link/Flow Maps


The getLinkLayer function creates a line layer (SpatialLinesDataFrame) from a list of links. gradLinkLayer displays these links graduated according to values of a variable.

Discontinuities Map


This map combines a choropleth map and a visualization of discontinuities. getBorders and discLayer allow to compute and display these discontinuities.

Gridded Map


The getGridLayer function builds a regular grid from a SpatialPolygonsDataFrame, getGridData transforms a dataset to fit in this grid and choroLayer maps the transformed data.

More ?

For all the maps, legends are configurable (text, size, position…). The map layout is set with the layoutLayer function that allows to choose a title, display a north arrow, a scale, an author and sources.

Some Technical Bits and Pieces

We have tried to minimize the package dependencies. So, only basic graphic functionalities (package graphics) are needed to display the layers. The only absolutely required packages are sp (spatial objects handling) and classInt (discretizations). However, to operate properly, some functions need other packages (rgeos, rgdal, rosm or raster).

Questions? Issues?

The stable release of the package is on CRAN and the development version is hosted on GitHub.
Feel free to submit an issue to report bugs or ask questions here.

Code of the Cartographic Mix

You can access the code used to generate the cartographic mix here (works with cartography version >= 1.2).


Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *