library(tidyverse)
library(sf)
Overview
Map of the Movements to Europe through the Mediterranean and Western Balkans migration routes, 2017 flows: Italy overview
. DataSource: @humdata
.
Source
# set the fonts
library(showtext)
library(sysfonts)
library(extrafont)
::showtext_auto()
showtext::showtext_opts(dpi=320)
showtextfont_add_google(name="Averia Libre",
family="Averia Libre")
library(readxl)
<- read_excel("R_general_resources/30DayMapChallenge/2022/day23_movement/data/2017-flows-to-europe-overview-dataset-3.xlsx",
X2017 sheet = "Origin Nationalites ITA-GRC-ESP")
<- rnaturalearthdata::countries110
world <- world_geo_data%>%
italy filter(sovereignt=="Italy")
<- X2017%>%
data ::clean_names() %>%
janitorleft_join(world_geo_data,by=c("iso3_of_origin"="sov_a3"))
<- data%>%
arrivals group_by(iso3_of_origin) %>%
summarize(arrivals=sum(cumulative_arrivals))
<- merge(arrivals,data) %>%
data1 st_as_sf()
<- data%>%
data_centroids st_as_sf()%>%
st_centroid()
<- world_geo_data%>%
italy_centroid filter(sovereignt=="Italy")%>%
st_centroid()
<- data_centroids%>%
start_coords st_coordinates()%>%
as.data.frame()%>%
filter(!X=="NaN")
<- italy_centroid%>%
end_coords st_coordinates()%>%
as.data.frame()
<- cbind(start_coords,end_coords)
df
names(df)<- c("lon_st","lat_st","lon_en","lat_en")
%>%head df
<- df %>%
en st_as_sf(coords=c("lon_en","lat_en"),crs=4326)%>%
st_geometry()
<- df %>%
st st_as_sf(coords=c("lon_st","lat_st"),crs=4326)%>%
st_geometry()
<- st_connect(st,en)
lines st_bbox(world_geo_data)
library(scico)
ggplot(world_geo_data)+
geom_sf(fill="grey90",alpha=0.2)+
geom_sf(data=italy,fill="#c15a4f")+
geom_sf(data=data1,aes(geometry=geometry,
fill=arrivals,
color=iso3_of_origin),
linewidth=0.1,
show.legend = T) +
guides(color="none",alpha="none") +
geom_sf(data= data1_centroids,
aes(color=iso3_of_origin),
size=0.05,
show.legend = FALSE)+
geom_sf(data=lines,
linewidth=0.01,
color="white")+
coord_sf(xlim = c(-170,170),ylim = c(-80,80)) +
#scale_alpha_binned()+
::scale_color_scico_d(begin=0,end = 1)+
scico::scale_fill_scico(begin=0,end = 1,
scico#alpha=0.5,
palette = "lisbon",
direction = 1)+
labs(title="Movements to Europe through the Mediterranean and Western Balkans migration routes",
subtitle="2017 flows: Italy overview",
fill="Arrivals",
caption="#30DayMapChallenge 2022 Day 23: Movement\nDataSource: @humdata | Map: Federica Gazzelloni (@fgazzelloni)")+
::theme_map() +
ggthemestheme(text=element_text(family="Averia Libre"),
plot.title = element_text(vjust = 2),
plot.caption = element_text(lineheight = 1.1,vjust = 2),
legend.background = element_blank(),
legend.position = c(0.05,0.1))
ggsave("day23_movement.png",
bg="#89a5b9",
width = 8.22,
height = 5.26,
dpi=280)