Learn R Programming

⚠️There's a newer version (4.0) of this package.Take me there.

tmap: thematic maps in R

<!------>

tmap is an actively maintained open-source R-library for drawing thematic maps, written by Martijn Tennekes. The API is based on A Layered Grammar of Graphics by Hadley Wickham and resembles the syntax of ggplot2, a popular R-library for drawing charts.

Installation

tmap is available on CRAN. The latest version is 1.8-1 (2017-01-29).

The tmap packages relies on the R packages rgdal and rgeos, which depend on the external libraries gdal, proj.4 and geos. On Windows, these are embedded in rgdal and rgeos. On Linux (Ubuntu), these libraries can be installed as follows:

sudo apt-get install libgdal-dev
sudo apt-get install libproj-dev
sudo apt-get install libgeos-dev

See source pages for gdal, proj, and geos. For Mac OS users, see http://www.kyngchaos.com.

Also, tmap relies indirectly on the R package V8. For Linux (Ubuntu), the v8 library needs to be installed for this:

sudo apt-get install libv8-dev

Development

Odd numbered versions will be development versions and even numbered versions stable CRAN releases (as with data.table).

The latest development version can be installed using devtools. In the latest development version, non-plotting functions have been migrated to tmaptools.

library(devtools)
install_github("mtennekes/tmaptools")
install_github("mtennekes/tmap")

See NEWS for the latest features and improvements and the issue list for discussions of enhancements and bugs.

Do you want to help with the development of the package? Please let me know! Any feedback, requests, tips, or bug reports are welcome!

Usage

library(tmap)

Vignettes, Demos, and Examples

tmap in a nutshell

tmap modes: plot and interactive view

demo pages

examples

Presentation

tmap: creating thematic maps in a flexible way

Other resources

Getting help

There are two main places to get help with ggplot2:

  1. stackoverflow is a great source of answers to common tmap questions. It is also a great place to get help, once you have created a reproducible example that illustrates your problem. Please tag your questions with tmap.
  2. If you have a request or if think your problem is caused by a bug, please open an issue, preferably with are reproducible example.

Copy Link

Version

Install

install.packages('tmap')

Monthly Downloads

31,639

Version

1.8-1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Martijn Tennekes

Last Published

January 28th, 2025

Functions in tmap (1.8-1)

qtm

Quick thematic map plot
rivers

Spatial data of rivers
tm_add_legend

Add manual legend
theme_ps

ggplot2 theme for proportional symbols
World

World, Europe, and Netherlands map
tm_logo

Logo
tm_iso

Draw iso (contour) lines with labels
tm_credits

Credits text
style_catalogue

Create a style catalogue
tm_compass

Map compass
tm_facets

Small multiples
tm_grid

Coordinate grid lines
tm_view

Options for the interactive tmap viewer
tmap_icons

Specify icons
tmap_leaflet

Create a leaflet widget from a tmap object
tm_scale_bar

Scale bar
tmap_style

Set the default tmap style
tmap_arrange

Arrange small multiples in grid layout
tmap-element

tmap element
tmap-package

Thematic Map Visualization
tmap_mode

Set tmap mode to static plotting or interactive viewing
land

Spatial data of global land cover
print.tmap

Draw thematic map
last_map

Retrieve the last map to be modified or created
animation_tmap

Create animation
tm_xlab

Axis labels
metro

Spatial data of metropolitan areas
save_tmap

Save tmap
+.tmap

Stacking of tmap elements
tm_fill

Draw polygons
tm_raster

Draw a raster
tm_lines

Draw spatial lines
tm_shape

Specify the shape object
tm_layout

Layout of cartographic maps
tm_symbols

Draw symbols
tm_text

Add text labels