The Economist
Topic: Average annual hours worked by persons engaged
Year: 1988-2017
library(gganimate)
library(gifski)
library(transformr)
graph1 <- df_plot %>%
ggplot(aes(year, avh, group = country, color = country)) +
geom_line(size = 1.25, show.legend = TRUE) +
theme_hc() +
scale_color_manual(values = my_colors) +
scale_x_continuous(limits = c(1986, 2017), breaks = seq(1986, 2017, 1),
labels = label_y, expand = c(0, 0)) +
scale_y_continuous(breaks = seq(1450, 3000, 250), limits = c(1450, 3000)) +
theme(panel.grid.minor = element_blank()) +
theme(panel.grid.major = element_line(color = "grey40", size = 0.2))+
theme(plot.margin = unit(c(0.7, 1, 1, 1), "cm")) +
labs(title = "Average annual hours worked by persons engaged",
subtitle = "Average annual hours worked is defined as the total number of hours actually worked per year\ndivided by the average number of people in employment per year.",
caption = "Source: The Penn World Table (PWT)") +
theme(plot.title = element_text(size = 20, color = "grey10", face = "bold"))+
theme(plot.subtitle = element_text(size = 12, color = "grey20", hjust = 0, margin = margin(b = 6)))+
theme(plot.caption = element_text(size = 8, color = "grey30", hjust = 1, margin = margin(t = 6))) +
theme(axis.title.x = element_blank()) +
theme(axis.title.y = element_blank()) +
theme(axis.text.x = element_text(size = 12, color = "grey30")) +
theme(axis.text.y = element_text(size = 12, color = "grey30")) +
theme(legend.title = element_blank())+
theme(legend.position = "right")+
theme(legend.text = element_text(size = 10, color = "grey20"))
graph1