library(sf)
## Warning: package 'sf' was built under R version 4.5.2
## Linking to GEOS 3.13.1, GDAL 3.11.4, PROJ 9.7.0; sf_use_s2() is TRUE
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(rnaturalearth)
## Warning: package 'rnaturalearth' was built under R version 4.5.2
library(rnaturalearthdata)
## Warning: package 'rnaturalearthdata' was built under R version 4.5.2
##
## Attaching package: 'rnaturalearthdata'
## The following object is masked from 'package:rnaturalearth':
##
## countries110
td_sensitivity <- data.frame(
country = c("Albania", "Poland", "Croatia", "Estonia", "Slovak Republic",
"Bulgaria", "Czechia", "Hungary", "Latvia",
"Romania", "Lithuania", "Slovenia"),
beta_country = c(10.24639, 9.910428, 9.877495, 9.824923, 9.599741,
9.521434, 9.458465, 9.27845, 9.044066,
8.692936, 8.399098, 7.710599)
)
mean_beta <- 9.677
td_sensitivity <- td_sensitivity %>%
mutate(sensitivity = ifelse(
beta_country > mean_beta,
"High trade dependency effect",
"Lower trade dependency effect"
))
europe_map <- ne_countries(
scale = "medium",
continent = "Europe",
returnclass = "sf"
)
td_sensitivity$country[td_sensitivity$country == "Slovak Republic"] <- "Slovakia"
map_data <- europe_map %>%
left_join(td_sensitivity, by = c("name" = "country"))
ggplot(map_data) +
geom_sf(aes(fill = sensitivity), color = "gray40", size = 0.2) +
scale_fill_manual(
values = c(
"High trade dependency effect" = "#d73027",
"Lower trade dependency effect" = "#1a9850"
),
na.value = "white"
) +
labs(
title = "Trade Dependency Sensitivity Map",
subtitle = expression("Classification based on average effect ("*beta*" = 9.677)"),
fill = "Trade dependency effect"
) +
theme_minimal() +
theme(
plot.title = element_text(face = "bold"),
legend.position = "right"
)

ggplot(map_data) +
geom_sf(aes(fill = sensitivity), color = "gray40", size = 0.2) +
scale_fill_manual(
values = c(
"High trade dependency effect" = "#d73027",
"Lower trade dependency effect" = "#1a9850"
),
na.value = "white"
) +
coord_sf(
xlim = c(8, 33),
ylim = c(39, 60),
expand = FALSE
) +
labs(
title = "Trade Dependency Sensitivity Map",
subtitle = expression("Eastern Europe – Classification based on average effect ("*beta*" = 9.677)"),
fill = "Trade dependency effect"
) +
theme_minimal() +
theme(
plot.title = element_text(face = "bold"),
legend.position = "right"
)
