Time zones

Category: geographical

thumbnail for this post
library(tidyverse)
library(sf)
library(lwgeom)
library(patchwork)
library(wesanderson)

blankbg <- theme(
  axis.line = element_blank(),
  axis.text.x = element_blank(),
  axis.text.y = element_blank(),
  axis.ticks = element_blank(),
  axis.title.x = element_blank(),
  axis.title.y = element_blank(),
  panel.background = element_blank(),
  panel.border = element_blank(),
  panel.grid.major = element_blank(),
  panel.grid.minor = element_blank(),
  plot.background = element_blank(),
)

# download SHP files for country borders and time zones from
# https://www.naturalearthdata.com/downloads/
countries <- read_sf('ne_10m_admin_0_countries.shp')
time_zones <- read_sf('ne_10m_time_zones.shp')

p <-
  ggplot() +
  geom_sf(
    data = countries, fill = 'grey', color = 'black', alpha = 1, size = 0.1,
    show.legend = FALSE
  ) +
  geom_sf(
    data = time_zones %>% mutate(name = as.integer(name)), aes(fill = name),
    alpha = 0.8, color = 'black', size = 0.35, show.legend = FALSE
  ) +
  blankbg +
  scale_fill_gradientn(
    colours = wes_palette('Zissou1', 21, type = 'continuous')
  ) +
  theme(plot.background = element_rect(fill = 'white', color = NA))

ggsave('time_zones_1.png',p , width = 9.5, height = 5)