International Independence Days

Welcome to TidyTuesday 2021 week 28

Networks
Published

July 6, 2021

library(tidyverse)
tuesdata <- tidytuesdayR::tt_load(2021, week = 28)

holidays <- tuesdata$holidays
names(holidays)
library(maps)
library(sf)

maps::map("world")
world <- sf::st_as_sf(map("world",plot=FALSE,fill=TRUE))
world <- cbind(world, sf::st_coordinates(sf::st_centroid(world)))
holidays_map <- holidays %>%
  filter(str_detect(name_of_holiday,"(?i)inde"))%>%
  left_join(world, by=c("country"="ID")) %>%
  select(country,date_parsed,name_of_holiday,independence_from,X,Y)%>%
  mutate(country=as.factor(country))
library(showtext)
library(extrafont)
showtext.auto(enable=FALSE)

“#EEE9E9”

mapdata <- ggplot2::map_data("world") %>%
  filter(!region==c("Antartica","Greenland","French Southern and Antartic Lands")) %>%
  mutate(region=recode(region, 
                       USA="United States",
                       UK="United Kingdom"))
           

final_plot <- ggplot() +
  geom_map(data=mapdata,map = mapdata,aes(map_id=region),fill= "#F0F8FF",color= "#FAEBD7")+
  geom_point(data=world,aes(x=X,y=Y),size=1,color="grey",alpha=0.3)+
  geom_point(data=holidays_map,aes(x=X,y=Y),size=0.5,color="black")+
  geom_text(data=holidays_map,aes(x=X,y=Y,label=country),family="Andalus",
                            check_overlap = TRUE,size=1.5,color="#363636",hjust=0,vjust=0)+ #
  geom_text(data=holidays_map,aes(x=X,y=Y,label=date_parsed),
            family="Andalus", check_overlap = TRUE,size=0.8,
            color="#CD1076",vjust=0.8,hjust=-1)+
  expand_limits(x=mapdata$long,y=mapdata$lat)+
  coord_map(projection = "mercator",xlim=c(-180,180)) +
  labs(title="Date parsed: Independent Days celebrating Countries",
       caption= "DataViz: @fgazzelloni, DataSource: International Independence Days,    Wikipedia,WorldAtlas.com - #TidyTuesday w28")+
  guides(fill="none") +
  ggthemes::theme_map()+
    theme(axis.text = element_blank(),
          plot.background = element_rect(fill="#C5E5F0",color="#E0EEEE"),
          plot.title = element_text(color="#363636",family="Andalus",size=18,face="bold"),
          plot.caption = element_text(size=10))



final_plot
###################### SAVING ############################


ragg::agg_png(here::here("w28","w28_independence_days.png"),
              res = 320, width = 14, height = 8, units = "in")
final_plot

dev.off()

##################################################