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.

Quick plotting method

qtm()Plot a thematic map
———————————————————————-

Main plotting method

Shape specification:

tm_shape()Specify a shape object

Aesthetics base layers:

tm_polygons()Create a polygon layer (with borders)
tm_symbols()Create a layer of symbols
tm_lines()Create a layer of lines
tm_raster()Create a raster layer
tm_text()Create a layer of text labels
tm_basemap()Create a layer of basemap tiles
tm_tiles()Create a layer of overlay tiles

Aesthetics derived layers:

tm_fill()Create a polygon layer (without borders)
tm_borders()Create polygon borders
tm_bubbles()Create a layer of bubbles
tm_squares()Create a layer of squares
tm_dots()Create a layer of dots
tm_markers()Create a layer of markers
tm_iso()Create a layer of iso/contour lines
tm_rgb()Create a raster layer of an image

Faceting (small multiples)

tm_facets()Define facets

Attributes:

tm_grid()Create grid lines
tm_scale_bar()Create a scale bar
tm_compass()Create a map compass
tm_credits()Create a text for credits
tm_logo()Create a logo
tm_xlab() and tm_ylab()Create axis labels
tm_minimap()Create a minimap (view mode only)

Layout element:

tm_layout()Adjust the layout (main function)
tm_legend()Adjust the legend
tm_view()Configure the interactive view mode
tm_style()Apply a predefined style
tm_format()Apply a predefined format

Change options:

tmap_mode()Set the tmap mode: "plot" or "view"
ttm()Toggle between the modes
tmap_options()Set global tmap options (from tm_layout(), tm_view(), and a couple of others)
tmap_style()Set the default style

Create icons:

tmap_icons()Specify icons for markers or proportional symbols

Output functions

print()Plot in graphics device or view interactively in web browser or RStudio's viewer pane
tmap_last()Redraw the last map
tmap_leaflet()Obtain a leaflet widget object
tmap_animation()Create an animation
tmap_arrange()Create small multiples of separate maps
tmap_save()Save 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