Skip to content
Back to skills

Ggmap

ASecurity

R ggmap package for maps with ggplot2. Use for Google Maps and Stamen tiles with ggplot2.

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

Works with

  • api

Security analysis

A100/100

Scanned June 4, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Ggmap?

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

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

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: ggmap
description: R ggmap package for maps with ggplot2. Use for Google Maps and Stamen tiles with ggplot2.
---

# ggmap Package

ggplot2-style maps with tile backgrounds.

## Get Map Tiles

```r
library(ggmap)

# Stamen maps (no API key needed)
map <- get_stadiamap(
  bbox = c(left = -122.5, bottom = 37.5, right = -122, top = 38),
  zoom = 12,
  maptype = "stamen_toner_lite"
)

# Google Maps (requires API key)
register_google(key = "YOUR_API_KEY")
map <- get_googlemap(
  center = c(lon = -122.4, lat = 37.8),
  zoom = 12,
  maptype = "roadmap"
)
```

## Plot Map

```r
ggmap(map)

# With points
ggmap(map) +
  geom_point(data = df, aes(x = lon, y = lat), color = "red", size = 3)
```

## Add Layers

```r
ggmap(map) +
  geom_point(data = df, aes(x = lon, y = lat, color = category)) +
  geom_path(data = route, aes(x = lon, y = lat)) +
  scale_color_viridis_d()
```

## Density Maps

```r
ggmap(map) +
  stat_density_2d(
    data = df,
    aes(x = lon, y = lat, fill = after_stat(level)),
    geom = "polygon",
    alpha = 0.3
  ) +
  scale_fill_viridis_c()
```

## Geocoding

```r
# Google geocoding (requires API)
geocode("1600 Pennsylvania Ave, Washington DC")

# Reverse geocoding
revgeocode(c(-77.0365, 38.8977))
```

## Routes

```r
# Google directions (requires API)
route <- route(
  from = "San Francisco, CA",
  to = "Los Angeles, CA",
  mode = "driving"
)

ggmap(map) +
  geom_path(data = route, aes(x = lon, y = lat), color = "blue", size = 2)
```

## Map Types

```r
# Stadia/Stamen types
"stamen_toner"
"stamen_toner_lite"
"stamen_watercolor"
"stamen_terrain"

# Google types
"roadmap"
"satellite"
"terrain"
"hybrid"
```

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…