Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active August 4, 2022 02:13
Show Gist options
  • Save mdsumner/d8dbaa0e2c04f78056d98b332ebab0ac to your computer and use it in GitHub Desktop.
Save mdsumner/d8dbaa0e2c04f78056d98b332ebab0ac to your computer and use it in GitHub Desktop.
  library(dplyr)
library(sf)
library(ggplot2)
library(orsifronts)
library(wesanderson)

sf_use_s2(FALSE)
proj <- "+proj=laea +lon_0=160 +lat_0=-60"
map_df <- st_as_sf(geodata::world(resolution = 5, path = tempdir()))

map_df <- filter(map_df, NAME_0 %in% c("Antarctica", "Australia", "New Zealand"))
map_df <- st_transform(map_df, proj)
bb <- st_bbox(c(xmin = -3e6, ymin = -3e6, xmax = 3e6, ymax = 3e6))
map_df <- st_crop(map_df, bb)
pts <- tibble::tibble(lon = seq(130, 160, length.out = 6), lat = c(-60, -50, -55, -40, -40, -60))
ggplot(map_df) +
  geom_sf(fill = "black", lwd = 0) + 
  geom_point(data = pts, aes(lon, lat), col = "hotpink") + 
  coord_sf( expand = FALSE, 
            default_crs = "OGC:CRS84", lims_method = "geometry_bbox")

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment