Why is Greenland so big?
Take a closer look at the plot. Why does Greenland look bigger than the contiguous US when it's actually only about one-third the size?
When you plot longitude and latitude locations on the x- and y-axes of a plot, you are treating 1 degree of longitude as the same size no matter where you are. However, because the earth is roughly spherical, the distance described by 1 degree of longitude depends on your latitude, varying from 111km at the equator, to 0 km at the poles.
The way you have taken positions on a sphere and drawn them in a two dimensional plane is described by a projection. The default you've used here (also known as an Equirectangular projection) distorts the width of areas near the poles. Every projection involves some kind of distortion (since a sphere isn't a plane!), but different projections try to preserve different properties (e.g. areas, angles or distances).
In tmap
, tm_shape()
takes an argument projection
that allows you to swap projections for the plot.
(Note: changing the projection of a ggplot2
plot is done using the coord_map()
function. See ?coord_map()
for more details.)
This exercise is part of the course
Visualizing Geospatial Data in R
Exercise instructions
To help you see the differences between projections, we've added a tm_grid()
layer which adds equispaced longitude and latitude lines to the plot.
Within your tm_shape()
call:
- Try a Hobo–Dyer projection (
projection = "hd"
), designed to preserve area. - In a second plot, try a Robinson projection (
projection = "robin"
), designed as a compromise between preserving local angles and area. - Just for fun, repeat the previous plot, but add
tm_style("classic")
to see howtmap
can control all aspects of the maps display.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
library(sp)
library(tmap)
# Switch to a Hobo–Dyer projection
tm_shape(countries_spdf) +
tm_grid(n.x = 11, n.y = 11) +
tm_fill(col = "population", style = "quantile") +
tm_borders(col = "burlywood4")
# Switch to a Robinson projection
tm_shape(countries_spdf) +
tm_grid(n.x = 11, n.y = 11) +
tm_fill(col = "population", style = "quantile") +
tm_borders(col = "burlywood4")
# Add tm_style("classic") to your plot