rggplot2gisgeom-sf

What is ggplot's default projection for EPSG 4326?


Running the basic code below generates a map with compressed latitude lines near the poles. It resembles Gall-Peters, but what is it?

library(tmap)
library(sf)
library(tidyverse)


sf_use_s2(TRUE) ## helps us with spherical geometry
data("World") ## get built-in data from the tmap package
world.sf <- World
st_crs(world.sf)
ggplot(world.sf) + geom_sf()

Solution

  • The default projection is equirectangular, aka plate caree. One degree of lat is the same size as one degree of long everywhere.

    You can confirm this by adding some 5x5 square lat-long polygons around the extremes and note how they are projected as squares:

    sq = st_sfc(st_polygon(list(cbind(c(0,5,5,0,0),c(82,82,87,87,82)))), crs=st_crs(World))
    sq2 = st_sfc(st_polygon(list(cbind(c(170,175,175,170,170),c(82,82,87,87,82)))), crs=st_crs(World))
    
    ggplot(World) + geom_sf() + geom_sf(data=sq) + geom_sf(data=sq2)
    

    enter image description here

    Gall-Peters is like an elliptical cylinder viewed from the side, Plate Caree is ignoring the spherical nature of lat-long and plotting it as if it was cartesian coordinates. In Plate Caree you can even have stupid things like latitudes greater than 90 degrees...

    sq = st_sfc(st_polygon(list(cbind(c(0,5,5,0,0),c(82,82,187,187,82)))), crs=st_crs(World))
    ggplot(World) + geom_sf() + geom_sf(data=sq)
    

    The help page for tm_shape shows how to plot this map in Eckhart IV projection, by default it too uses plate caree (but with a check for latitudes off the pols).

    tm_shape(World, projection="+proj=eck4") +
             tm_polygons() + 
         tm_layout("Eckhart IV projection. Recommended in statistical maps for its equal-area property.",
             inner.margins=c(0,0,.1,0), title.size=.8)
    

    enter image description here

    I think its mention as "default" in help(World) is really the projection that Natural Earth prefer for this data.