Learn R Programming

tmap (version 1.6)

tmap-package: Thematic Maps

Description

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.

Arguments

Quick plotting method

qtm
To plot a thematic map
---------------------------
---------------------------------------------------------------------------------------------------

Main plotting method

Shape specification:
tm_shape
To specify a shape object
---------------------------
---------------------------------------------------------------------------------------------------
Aesthetics base layers:
tm_polygons
To create a polygon layer (with borders)
tm_symbols
To create a layer of symbols
tm_lines
To create a layer of lines
tm_raster
To create a raster layer
tm_text
To create a layer of text labels
Aesthetics derived layers:
tm_fill
To create a polygon layer (without borders)
tm_borders
To create polygon borders
tm_bubbles
To create a layer of bubbles
tm_squares
To create a layer of squares
tm_dots
To create a layer of dots
tm_markers
To create a layer of markers
tm_iso
To create a iso/contour lines
---------------------------
---------------------------------------------------------------------------------------------------
Facetting (small multiples)
tm_facets
To define facets
---------------------------
---------------------------------------------------------------------------------------------------
Attributes:
tm_grid
To create grid lines
tm_scale_bar
To create a scale bar
tm_compass
To create a map compass
tm_credits
To create a text for credits
tm_logo
To create a logo
tm_xlab and tm_ylab
To create axis labels
---------------------------
---------------------------------------------------------------------------------------------------
Layout element:
tm_layout
To adjust the layout (main function)
tm_legend
Shortcut to adjust the legend
tm_view
Options for the interactive view mode
---------------------------
---------------------------------------------------------------------------------------------------
Change options:
tmap_mode
To set the tmap mode: "plot" or "view"
ttm
To toggle between the modes
tmap_style
To set the default style
---------------------------
---------------------------------------------------------------------------------------------------

Handy tool functions

bb
To create, extract or modify a bounding box
geocode_OSM
To get location from an address description
rev_geocode_OSM
To get address description from a location
get_asp_ratio
To get the aspect ratio of a shape object
get_IDs
To get ID values of a shape object
append_data
To append a data frame to a shape object
approx_areas
To approximate area sizes of polygons
calc_densities
To calculate density values
get_projection
To get the map projection
set_projection
To set the map projection
split
To split a shape object
sbind
To bind shape objects
crop_shape
To crop shape objects
map_coloring
To color polygons with different colors for adjacent polygons
tmap_icons
To specify icons for markers or proportional symbols
---------------------------
---------------------------------------------------------------------------------------------------

Statistical transformation functions

smooth_map
To create a smooth map (raster, contour lines and kernel density polygons)
smooth_raster_cover
To create a smooth cover of a raster object
sample_dots
To sample dots from polygons
points_to_raster
To bin spatial points to a raster
poly_to_raster
To convert polygons to a raster
cartogram
To create cartogram polygons
---------------------------
---------------------------------------------------------------------------------------------------

Input functions

read_shape
To read a shape object
read_GPX
To read a GPX file
read_osm
To read Open Street Map data
---------------------------
---------------------------------------------------------------------------------------------------

Output functions

print
Plot in graphics device or view interactively in web browser or RStudio's viewer pane
last_map
Redraw the last map
tmap_leaflet
Obtain a leaflet widget object
animation_tmap
Create an animation
save_tmap
To save thematic maps (both in plot and view mode)
write_shape
To write a shape object
---------------------------
---------------------------------------------------------------------------------------------------

Spatial datasets

World
World country data (spatial polygons)
Europe
European country data (spatial polygons)
NLD_prov
Netherlands province data (spatial polygons)
NLD_muni
Netherlands municipal data (spatial polygons)
metro
Metropolitan araes (spatial points)
rivers
Rivers (spatial lines)
land
Global land cover (spatial grid)
---------------------------
---------------------------------------------------------------------------------------------------

Details

This page provides a brief overview of all package functions. See vignette("tmap-nutshell") for a short introduction with examples. See vignette("tmap-modes") for a short demo of the two output modes: plot and interactive view.

See Also

vignette("tmap-nutshell")

vignette("tmap-modes")