Skip to content

Instantly share code, notes, and snippets.

@adamhsparks
Last active April 9, 2020 07:08
Show Gist options
  • Save adamhsparks/be445e423360ca9b056d368a6309950a to your computer and use it in GitHub Desktop.
Save adamhsparks/be445e423360ca9b056d368a6309950a to your computer and use it in GitHub Desktop.
Quickly creates a generic map using ggplot2, sf and rnaturalearth
library("ggplot2")
library("ggthemes")
theme_set(theme_map())
library("sf")
library("rnaturalearth")
library("rnaturalearthdata")
world <- ne_countries(scale = "medium", returnclass = "sf")
ctry <- world[world$name == "Philippines", ]
ggplot(data = ctry) +
geom_sf() +
labs(caption = "Data source: Natural Earth Data")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment