Skip to content

Instantly share code, notes, and snippets.

@thoughtfulbloke
Created August 31, 2025 23:56
Show Gist options
  • Save thoughtfulbloke/0b0bbbf946ec7dcdf831e662f592ddb0 to your computer and use it in GitHub Desktop.
Save thoughtfulbloke/0b0bbbf946ec7dcdf831e662f592ddb0 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(maps)
library(dplyr)
# while the position data in the maps package
# is very basic, that makes it simple to transform
nz_map <- map_data("nz")
nz_anti <- nz_map %>%
mutate(
lat = -lat,
long = ifelse(long > 0, long - 180, long + 180)
)
the_world <- map_data("world")
ggplot() +
geom_polygon(data = the_world, aes(x = long, y = lat, group = group),
fill = "cornsilk", color = "black") +
geom_polygon(data = nz_anti, aes(x = long, y = lat, group = group),
fill = "#CC0000AA", color = "black") +
coord_quickmap(xlim = c(-15,15), ylim=c(30,50)) +
labs(title = "Aotearoa Antipodised\n") +
theme_void()
ggsave(filename="~/Desktop/amap.jpg",
height=4.5, width = 8, dpi=150, units = "in", bg = "white")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment