Learn R Programming

⚠️There's a newer version (3.3-4) 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.6-1 (2016-10-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.

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", subdir = "pkg")

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

Copy Link

Version

Install

install.packages('tmap')

Monthly Downloads

23,265

Version

1.6-1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Last Published

September 12th, 2023

Functions in tmap (1.6-1)

bb

Bounding box generator
geocode_OSM

Geocodes a location using OpenStreetMap Nominatim
append_data

Append data to a shape object
calc_densities

Calculate densities
offset_line

Create a double line or offset line
animation_tmap

Create animation
approx_areas

Approximate area sizes of the shapes
cartogram

Cartogram
tm_xlab

Axis labels
crop_shape

Crop shape object
poly_to_raster

Convert spatial polygons to a raster
last_map

Retrieve the last map to be modified or created
metro

Spatial data of metropolitan areas
map_coloring

Map coloring
get_IDs

Get ID's of the shape items
get_proj4

Get a PROJ.4 character string
points_to_raster

Bin spatial points to a raster
+.tmap

Stacking of tmap elements
get_asp_ratio

Get aspect ratio
land

Spatial data of global land cover
read_GPX

Read GPX file
print.tmap

Draw thematic map
rev_geocode_OSM

Reverse geocodes a location using OpenStreetMap Nominatim
rivers

Spatial data of rivers
sample_dots

Sample dots from spatial polygons
sbind

Combine shape objects
qtm

Quick thematic map plot
read_shape

Read shape file
read_osm

Read Open Street Map data
save_tmap

Save tmap
theme_ps

ggplot2 theme for proportional symbols
tm_credits

Credits text
tm_add_legend

Add manual legend
smooth_raster_cover

Get a smoothed cover of a raster object
split.SpatialPolygons

Divide into multiple shape objects
style_catalogue

Create a style catalogue
set_projection

Set and get the map projection
World

World, Europe, and Netherlands map
tm_facets

Small multiples
tm_compass

Map compass
tmap_leaflet

Create a leaflet widget from a tmap object
tm_iso

Draw iso (contour) lines with labels
tm_scale_bar

Scale bar
tmap-element

tmap element
tmap_style

Set the default tmap style
tmap_icons

Specify icons
tmap_mode

Set tmap mode to static plotting or interactive viewing
tm_logo

Logo
tm_view

Options for the interactive tmap viewer
tm_grid

Coordinate grid lines
tmap-package

Thematic Map Visualization
write_shape

Write shape file
tmap_arrange

Arrange small multiples in grid layout