Skip to contents

tmap is a R package for visualizing spatial data. This package is an extension. It features two new modes: "mapbox" and "maplibre".

Installation

This package is in development so the development version of both tmap and tmap.mapgl are required.

tmap

# install.packages("remotes")
remotes::install_github("r-tmap/tmap")

# install.packages("pak")
pak::pak("r-tmap/tmap")

# Or from r-universe
install.packages("tmap", repos = c("https://r-tmap.r-universe.dev", "https://cloud.r-project.org"))

For Linux and macOS users who are new to working with spatial data in R, this may fail since additional (non-R) libraries are required (which are automatically installed for Windows users).

tmap.mapgl

# install.packages("remotes")
remotes::install_github("r-tmap/tmap.mapgl")

# install.packages("pak")
pak::pak("r-tmap/tmap.mapgl")

# Or from r-universe
install.packages("tmap.mapgl", repos = c("https://r-tmap.r-universe.dev", "https://cloud.r-project.org"))

Example

library(tmap)
library(tmap.mapgl)

tmap_mode("mapbox")

tm_shape(World) + 
  tm_polygons("well_being",
    fill.scale = tm_scale_continuous(values = "pu_gn"))
tmap mapbox mode