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

propSymbols
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

propchoro
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

labels

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

Link/Flow Maps

link

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

disc

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

Gridded Map

dens

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

cartomix


OpenEdition vous propose de citer ce billet de la manière suivante :
Timothée Giraud (12 février 2016). Create and integrate maps in your R workflow with the cartography package. R Géomatique. Consulté le 7 septembre 2024 à l’adresse https://doi.org/10.58079/tp3p


Laisser un commentaire

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

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.