options(gganimate.nframes = 50, gganimate.end_pause = 10)
nama_10r_3empers %>%
filter(nchar(geo) == 4,
wstatus == "EMP",
nace_r2 %in% c("TOTAL", "A")) %>%
left_join(geo, by = "geo") %>%
spread(nace_r2, values) %>%
mutate(`Share (%)` = round(100* `A` / TOTAL, 1),
year = as.integer(time)) %>%
filter(!is.na(year),
year >= 2000) %>%
select(year, geo, `Share (%)`) %>%
right_join(europe_NUTS2, by = "geo") %>%
filter(long >= -15, lat >= 33) %>%
na.omit %>%
ggplot(aes(x = long, y = lat, group = group)) +
geom_polygon(aes(fill = `Share (%)`/100)) + coord_map() +
scale_fill_viridis_c(na.value = "grey",
labels = scales::percent_format(accuracy = 1),
breaks = 0.01*seq(0, 50, 10),
values = c(0, 0.1, 0.2, 1)) +
theme_void() + theme(legend.position = c(0.25, 0.85)) +
labs(fill = "Agriculture (%)") +
transition_time(year) +
labs(title = "Year: {frame_time}")