To cite Federica’s work please use:
Gazzelloni F. (2023), Data Visualization: Eurosat hlth_hlye data
id <- search_eurostat("Healthy life years by sex")
id <- id[1,]
id
# save(id,file="id.RData")data <- get_eurostat("hlth_hlye",unit="PC")
# save(data,file="data.RData")my_countries_abbr <- unique(df$geo)df_countries <- df%>%
inner_join(my_countries,by=c("geo"="iso2c"))
df_countries%>%headpolygons <- rnaturalearth::ne_countries(returnclass = "sf")
ggplot()+
geom_sf(data=polygons)+
geom_sf(data=df_geometry,aes(geometry=geometry),color="red")Zooming in
source: https://www.r-bloggers.com/2019/04/zooming-in-on-maps-with-sf-and-ggplot2/
map +
scale_fill_gradient(low = "white",high = "#a60845") +
labs(title="Healthy life years by sex (2020) %",
caption="DataSource: Eurosat - Healthy life years by sex\n#30DayChartChallenge day18 Eurosat | DataViz: Federica Gazzelloni") +
ggthemes::theme_map(base_size = 12, base_family = "Roboto Condensed")+
theme(strip.background = element_rect(color = "#a60845",fill="#a60845"),
strip.text = element_text(color="white"),
legend.position = "bottom",
plot.title = element_text(color="#a60845",size=20),
plot.caption = element_text(color="#a60845",size=12))ggsave("map.png",width = 7,height = 5)