Skip to content
Back to skills

Cartography

ASecurity

R cartography package for thematic mapping. Use for creating publication-quality thematic maps.

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

Security analysis

A100/100

Scanned June 4, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Cartography?

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

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

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: cartography
description: R cartography package for thematic mapping. Use for creating publication-quality thematic maps.
---

# cartography

Thematic cartography.

## Basic Map

```r
library(cartography)
library(sf)

# Read data
mtq <- st_read(system.file("gpkg/mtq.gpkg", package = "cartography"))

# Plot base map
plot(st_geometry(mtq), col = "lightblue", border = "white")
```

## Choropleth Map

```r
# Choropleth
choroLayer(
  x = mtq,
  var = "MED",
  method = "quantile",
  nclass = 5,
  col = carto.pal("green.pal", 5),
  border = "white",
  legend.title.txt = "Median Income"
)
```

## Proportional Symbols

```r
# Proportional circles
propSymbolsLayer(
  x = mtq,
  var = "POP",
  col = "red",
  border = "white",
  legend.title.txt = "Population"
)

# Proportional + choropleth
propSymbolsChoroLayer(
  x = mtq,
  var = "POP",
  var2 = "MED",
  col = carto.pal("blue.pal", 4)
)
```

## Typology Map

```r
# Categorical map
typoLayer(
  x = mtq,
  var = "STATUS",
  col = carto.pal("pastel.pal", 4),
  legend.title.txt = "Status"
)
```

## Labels

```r
# Add labels
labelLayer(
  x = mtq,
  txt = "LIBGEO",
  col = "black",
  cex = 0.7,
  halo = TRUE
)
```

## Layout Elements

```r
# Title
layoutLayer(
  title = "Map Title",
  author = "Author",
  sources = "Data source",
  scale = 5,
  north = TRUE
)

# North arrow
north(pos = "topleft")

# Scale bar
barscale(size = 5)
```

## Color Palettes

```r
# Available palettes
display.carto.all()

# Get palette
carto.pal("green.pal", 5)
carto.pal("red.pal", 7)
carto.pal("blue.pal", 4)
carto.pal("orange.pal", 6)
```

## Smoothed Map

```r
# Kernel density
smoothLayer(
  x = mtq,
  var = "POP",
  typefct = "exponential",
  span = 3000,
  beta = 2
)
```

## Links/Flows

```r
# Flow map
gradLinkLayer(
  x = links,
  df = flow_data,
  xid = "origin",
  yid = "destination",
  var = "flow"
)
```

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.