Skip to content
Back to skills

Tmap

ASecurity

R tmap package for thematic maps. Use for publication-quality static and interactive maps.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
datago

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill tmap --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tmap?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tmap
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-tmap/badge)](https://www.skillsdirectory.com/skills/leolin990405-tmap)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tmap
description: R tmap package for thematic maps. Use for publication-quality static and interactive maps.
---

# tmap Package

Thematic maps with grammar of graphics style.

## Basic Map

```r
library(tmap)
library(sf)

tm_shape(shp) +
  tm_polygons("value")
```

## Map Layers

```r
# Polygons
tm_shape(polygons) +
  tm_polygons("variable",
    style = "quantile",
    palette = "Blues",
    title = "Legend Title"
  )

# Points
tm_shape(points) +
  tm_dots(size = "population", col = "red")

tm_shape(points) +
  tm_bubbles(size = "value", col = "category")

# Lines
tm_shape(roads) +
  tm_lines(col = "type", lwd = 2)

# Raster
tm_shape(raster) +
  tm_raster(palette = "viridis")
```

## Multiple Layers

```r
tm_shape(polygons) +
  tm_polygons("value") +
tm_shape(points) +
  tm_dots(col = "red") +
tm_shape(roads) +
  tm_lines()
```

## Layout

```r
tm_shape(shp) +
  tm_polygons("value") +
  tm_layout(
    title = "Map Title",
    legend.outside = TRUE,
    frame = FALSE
  ) +
  tm_compass(position = c("right", "top")) +
  tm_scale_bar(position = c("left", "bottom")) +
  tm_credits("Source: Data Provider")
```

## Facets

```r
tm_shape(shp) +
  tm_polygons("value") +
  tm_facets(by = "year", ncol = 3)
```

## Interactive Mode

```r
tmap_mode("view")  # Interactive
tmap_mode("plot")  # Static

# Current map interactive
tmap_last() %>% tmap_leaflet()
```

## Save

```r
map <- tm_shape(shp) + tm_polygons()
tmap_save(map, "map.png", width = 1920, height = 1080)
tmap_save(map, "map.html")
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.