2026-03-24
Kinds of maps
Basic maps
Adding points
Shading areas
Projections
ggmap (part of tidyverse)
Many other libraries
mapsrnaturalearth (see naturalearthdata.com)mapproj for making projections of the Earth’s surfacemapdata with maps of China and Japanleaflet for drawing raster or tiled maps (next lesson)Coastlines and political boundaries
Natural features (rivers, water bodies)
Points and filled regions on maps
Tiled maps
How to represent latitude and longitude from a sphere on a flat screen? (Projections.)
values <- tibble( region = WorldData |> pull(region) |> unique())
values <- values |> mutate(value = runif(nrow(values)))
m2 <- values |> ggplot() +
geom_map(aes(fill = value, map_id = region),
map = WorldData,
colour = "lightgray",
alpha = 1, linewidth=0.5) +
expand_limits(x = c(-180,180), y = c(-80,80)) +
theme_bw()values <- tibble( region = c("Canada", "China", "Chile"),
value = c(1, 2, 3))
m4 <- ggplot(data = WorldData, aes(map_id = region)) +
geom_map(map = WorldData,
colour = "lightgray", fill = "darkgray",
alpha = 1, linewidth=0.5) +
geom_map(aes(fill = value),
data = values, map = WorldData) +
expand_limits(x = c(-180,180), y = c(-80,80))+
theme_bw()library(rnaturalearth)
library(rnaturalearthdata)
library(ggrepel)
canada <- ne_countries(country = "canada", scale = "large",
returnclass = "sf")
sites <- tibble(longitude = c(-81, -80), latitude = c(44, 45),
label = c("A", "B"))
m5 <- ggplot(data = canada) +
geom_sf() +
geom_point(data = sites,
aes(x = longitude, y = latitude),
size = 4, shape = 21, fill = "darkred") +
geom_label_repel(data = sites,
aes(x = longitude, y = latitude,
label = label)) +
coord_sf(xlim = c(-140,-50), ylim = c(42,65))Make a basic map
Select all or some countries
Fill regions with colour
Add points and labels
Use a different projection