Skip to contents

Thematic maps are geographical maps in which spatial data distributions are visualized. This package offers a flexible, layer-based, and easy to use approach to create thematic maps, such as choropleths and bubble maps. It is based on the grammar of graphics, and resembles the syntax of ggplot2.

Details

This page provides a brief overview of all package functions. See vignette("tmap-getstarted") for a short introduction with examples.

Quick plotting method

qtmPlot a thematic map
------------------------------------------------------------------------------------------------------------------------------

Main plotting method

Shape specification:

tm_shapeSpecify a shape object
------------------------------------------------------------------------------------------------------------------------------

Aesthetics base layers:

tm_polygonsCreate a polygon layer (with borders)
tm_symbolsCreate a layer of symbols
tm_linesCreate a layer of lines
tm_rasterCreate a raster layer
tm_textCreate a layer of text labels
tm_basemapCreate a layer of basemap tiles
tm_tilesCreate a layer of overlay tiles

Aesthetics derived layers:

tm_fillCreate a polygon layer (without borders)
tm_bordersCreate polygon borders
tm_bubblesCreate a layer of bubbles
tm_squaresCreate a layer of squares
tm_dotsCreate a layer of dots
tm_markersCreate a layer of markers
tm_isoCreate a layer of iso/contour lines
tm_rgbCreate a raster layer of an image
------------------------------------------------------------------------------------------------------------------------------

Faceting (small multiples)

tm_facetsDefine facets
------------------------------------------------------------------------------------------------------------------------------

Attributes:

tm_gridCreate grid lines
tm_scale_barCreate a scale bar
tm_compassCreate a map compass
tm_creditsCreate a text for credits
tm_logoCreate a logo
tm_xlab and tm_ylabCreate axis labels
tm_minimapCreate a minimap (view mode only)
------------------------------------------------------------------------------------------------------------------------------

Layout element:

tm_layoutAdjust the layout (main function)
tm_legendAdjust the legend
tm_viewConfigure the interactive view mode
tm_styleApply a predefined style
tm_formatApply a predefined format
------------------------------------------------------------------------------------------------------------------------------

Change options:

tmap_modeSet the tmap mode: "plot" or "view"
ttmToggle between the modes
tmap_optionsSet global tmap options (from tm_layout, tm_view, and a couple of others)
tmap_styleSet the default style
------------------------------------------------------------------------------------------------------------------------------

Create icons:

tmap_iconsSpecify icons for markers or proportional symbols
------------------------------------------------------------------------------------------------------------------------------

Output functions

printPlot in graphics device or view interactively in web browser or RStudio's viewer pane
tmap_lastRedraw the last map
tmap_leafletObtain a leaflet widget object
tmap_animationCreate an animation
tmap_arrangeCreate small multiples of separate maps
tmap_saveSave thematic maps (either as image or HTML file)
------------------------------------------------------------------------------------------------------------------------------

Spatial datasets

WorldWorld country data (sf object of polygons)
NLD_provNetherlands province data (sf object of polygons)
NLD_muniNetherlands municipal data (sf object of polygons)
metroMetropolitan areas (sf object of points)
riversRivers (sf object of lines)
landGlobal land cover (stars object)
------------------------------------------------------------------------------------------------------------------------------

References

Tennekes, M., 2018, tmap: Thematic Maps in R, Journal of Statistical Software, 84(6), 1-39, doi:10.18637/jss.v084.i06

Author

Martijn Tennekes mtennekes@gmail.com