class: center, middle, inverse, title-slide # Introduction to gganimate ## Unemployment in Europe ### Luca Picci --- # Getting Started Showing the steps to create an animated bar chart can be tricky. -- In order to demonstrate the steps required to build this animated plot we will: -- - Build the skeleton of the plot (declare aesthetics and build the theme and annotations) -- - Then use facet_wrap() and declare the geoms to show the different bar lengths at each time period -- - Finally we will combine the plots and add the animation --- count: false Data Manipulation .panel1-plotdata-auto[ ```r *unemployment ``` ] .panel2-plotdata-auto[ ``` ## # A tibble: 810 x 5 ## LOCATION Country SUBJECT TIME Value ## <chr> <chr> <chr> <dbl> <dbl> ## 1 AUT Austria TOT 1999 4.97 ## 2 AUT Austria TOT 2000 5.15 ## 3 AUT Austria TOT 2001 5.7 ## 4 AUT Austria TOT 2002 6.18 ## 5 AUT Austria TOT 2003 7.05 ## 6 AUT Austria TOT 2004 10.5 ## 7 AUT Austria TOT 2005 11.0 ## 8 AUT Austria TOT 2006 9.8 ## 9 AUT Austria TOT 2007 9.38 ## 10 AUT Austria TOT 2008 8.48 ## # … with 800 more rows ``` ] --- count: false Data Manipulation .panel1-plotdata-auto[ ```r unemployment %>% * filter(SUBJECT == "TOT") ``` ] .panel2-plotdata-auto[ ``` ## # A tibble: 271 x 5 ## LOCATION Country SUBJECT TIME Value ## <chr> <chr> <chr> <dbl> <dbl> ## 1 AUT Austria TOT 1999 4.97 ## 2 AUT Austria TOT 2000 5.15 ## 3 AUT Austria TOT 2001 5.7 ## 4 AUT Austria TOT 2002 6.18 ## 5 AUT Austria TOT 2003 7.05 ## 6 AUT Austria TOT 2004 10.5 ## 7 AUT Austria TOT 2005 11.0 ## 8 AUT Austria TOT 2006 9.8 ## 9 AUT Austria TOT 2007 9.38 ## 10 AUT Austria TOT 2008 8.48 ## # … with 261 more rows ``` ] --- count: false Data Manipulation .panel1-plotdata-auto[ ```r unemployment %>% filter(SUBJECT == "TOT") %>% * filter(TIME>=2007) ``` ] .panel2-plotdata-auto[ ``` ## # A tibble: 164 x 5 ## LOCATION Country SUBJECT TIME Value ## <chr> <chr> <chr> <dbl> <dbl> ## 1 AUT Austria TOT 2007 9.38 ## 2 AUT Austria TOT 2008 8.48 ## 3 AUT Austria TOT 2009 10.6 ## 4 AUT Austria TOT 2010 9.48 ## 5 AUT Austria TOT 2011 8.95 ## 6 AUT Austria TOT 2012 9.4 ## 7 AUT Austria TOT 2013 9.68 ## 8 AUT Austria TOT 2014 10.3 ## 9 AUT Austria TOT 2015 10.6 ## 10 AUT Austria TOT 2016 11.2 ## # … with 154 more rows ``` ] --- count: false Data Manipulation .panel1-plotdata-auto[ ```r unemployment %>% filter(SUBJECT == "TOT") %>% filter(TIME>=2007) %>% * filter(Country!= "Estonia") ``` ] .panel2-plotdata-auto[ ``` ## # A tibble: 154 x 5 ## LOCATION Country SUBJECT TIME Value ## <chr> <chr> <chr> <dbl> <dbl> ## 1 AUT Austria TOT 2007 9.38 ## 2 AUT Austria TOT 2008 8.48 ## 3 AUT Austria TOT 2009 10.6 ## 4 AUT Austria TOT 2010 9.48 ## 5 AUT Austria TOT 2011 8.95 ## 6 AUT Austria TOT 2012 9.4 ## 7 AUT Austria TOT 2013 9.68 ## 8 AUT Austria TOT 2014 10.3 ## 9 AUT Austria TOT 2015 10.6 ## 10 AUT Austria TOT 2016 11.2 ## # … with 144 more rows ``` ] --- count: false Data Manipulation .panel1-plotdata-auto[ ```r unemployment %>% filter(SUBJECT == "TOT") %>% filter(TIME>=2007) %>% filter(Country!= "Estonia")%>% * select(-LOCATION) ``` ] .panel2-plotdata-auto[ ``` ## # A tibble: 154 x 4 ## Country SUBJECT TIME Value ## <chr> <chr> <dbl> <dbl> ## 1 Austria TOT 2007 9.38 ## 2 Austria TOT 2008 8.48 ## 3 Austria TOT 2009 10.6 ## 4 Austria TOT 2010 9.48 ## 5 Austria TOT 2011 8.95 ## 6 Austria TOT 2012 9.4 ## 7 Austria TOT 2013 9.68 ## 8 Austria TOT 2014 10.3 ## 9 Austria TOT 2015 10.6 ## 10 Austria TOT 2016 11.2 ## # … with 144 more rows ``` ] --- count: false Data Manipulation .panel1-plotdata-auto[ ```r unemployment %>% filter(SUBJECT == "TOT") %>% filter(TIME>=2007) %>% filter(Country!= "Estonia")%>% select(-LOCATION) %>% * select(-SUBJECT) ``` ] .panel2-plotdata-auto[ ``` ## # A tibble: 154 x 3 ## Country TIME Value ## <chr> <dbl> <dbl> ## 1 Austria 2007 9.38 ## 2 Austria 2008 8.48 ## 3 Austria 2009 10.6 ## 4 Austria 2010 9.48 ## 5 Austria 2011 8.95 ## 6 Austria 2012 9.4 ## 7 Austria 2013 9.68 ## 8 Austria 2014 10.3 ## 9 Austria 2015 10.6 ## 10 Austria 2016 11.2 ## # … with 144 more rows ``` ] --- count: false Data Manipulation .panel1-plotdata-auto[ ```r unemployment %>% filter(SUBJECT == "TOT") %>% filter(TIME>=2007) %>% filter(Country!= "Estonia")%>% select(-LOCATION) %>% select(-SUBJECT) -> * plotdata ``` ] .panel2-plotdata-auto[ ] <style> .panel1-plotdata-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-plotdata-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-plotdata-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false Building the Plot .panel1-plot1-auto[ ```r *ggplot(data = plotdata) ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_01_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + * aes(y = reorder(Country, Value)) ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_02_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ * aes(x = Value) ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_03_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ * geom_segment(aes(x = 0, xend = 65, * yend = Country), * size = 7.5, * color = "azure3") ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_04_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ * scale_x_continuous(position = "top", * breaks = c(0, 25, 50), * labels= * function(x) paste0(x,"%")) ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_05_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ scale_x_continuous(position = "top", breaks = c(0, 25, 50), labels= function(x) paste0(x,"%"))+ * labs(title = "Euro Area Youth Unemployment Rate 2007 - 2017") ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_06_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ scale_x_continuous(position = "top", breaks = c(0, 25, 50), labels= function(x) paste0(x,"%"))+ labs(title = "Euro Area Youth Unemployment Rate 2007 - 2017")+ * labs(subtitle = "Youth unemployment (15-24 years) expressed as a percent of the youth labour force") ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_07_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ scale_x_continuous(position = "top", breaks = c(0, 25, 50), labels= function(x) paste0(x,"%"))+ labs(title = "Euro Area Youth Unemployment Rate 2007 - 2017")+ labs(subtitle = "Youth unemployment (15-24 years) expressed as a percent of the youth labour force")+ * labs(y = NULL) ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_08_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ scale_x_continuous(position = "top", breaks = c(0, 25, 50), labels= function(x) paste0(x,"%"))+ labs(title = "Euro Area Youth Unemployment Rate 2007 - 2017")+ labs(subtitle = "Youth unemployment (15-24 years) expressed as a percent of the youth labour force")+ labs(y = NULL)+ * labs(caption = "*excl. Malta, Cyprus, Estonia\nSource:OECD (2020), Youth unemployment rate (indicator)") ``` ] .panel2-plot1-auto[ ![](unemployment_files/figure-html/plot1_auto_09_output-1.png)<!-- --> ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ scale_x_continuous(position = "top", breaks = c(0, 25, 50), labels= function(x) paste0(x,"%"))+ labs(title = "Euro Area Youth Unemployment Rate 2007 - 2017")+ labs(subtitle = "Youth unemployment (15-24 years) expressed as a percent of the youth labour force")+ labs(y = NULL)+ labs(caption = "*excl. Malta, Cyprus, Estonia\nSource:OECD (2020), Youth unemployment rate (indicator)")-> * plot ``` ] .panel2-plot1-auto[ ] --- count: false Building the Plot .panel1-plot1-auto[ ```r ggplot(data = plotdata) + aes(y = reorder(Country, Value))+ aes(x = Value)+ geom_segment(aes(x = 0, xend = 65, yend = Country), size = 7.5, color = "azure3")+ scale_x_continuous(position = "top", breaks = c(0, 25, 50), labels= function(x) paste0(x,"%"))+ labs(title = "Euro Area Youth Unemployment Rate 2007 - 2017")+ labs(subtitle = "Youth unemployment (15-24 years) expressed as a percent of the youth labour force")+ labs(y = NULL)+ labs(caption = "*excl. Malta, Cyprus, Estonia\nSource:OECD (2020), Youth unemployment rate (indicator)")-> plot ``` ] .panel2-plot1-auto[ ] <style> .panel1-plot1-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-plot1-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-plot1-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false Building the Theme .panel1-plot2-auto[ ```r *plot ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_01_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ * theme(panel.background = * element_rect(fill = "grey99")) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_02_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ * theme(plot.background = * element_rect(fill = "grey99")) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_03_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ * theme(panel.grid = element_blank()) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_04_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ * theme(plot.title = * element_text(size = 18, hjust = 0, * color = "steelblue4", * face = "bold")) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_05_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ theme(plot.title = element_text(size = 18, hjust = 0, color = "steelblue4", face = "bold"))+ * theme(plot.subtitle = * element_text(size = 12, * color = "darkgoldenrod2", * hjust = 0, face = "bold")) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_06_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ theme(plot.title = element_text(size = 18, hjust = 0, color = "steelblue4", face = "bold"))+ theme(plot.subtitle = element_text(size = 12, color = "darkgoldenrod2", hjust = 0, face = "bold"))+ * theme(plot.caption = * element_text(color = "steelblue4", * hjust = 0.94)) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_07_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ theme(plot.title = element_text(size = 18, hjust = 0, color = "steelblue4", face = "bold"))+ theme(plot.subtitle = element_text(size = 12, color = "darkgoldenrod2", hjust = 0, face = "bold"))+ theme(plot.caption = element_text(color = "steelblue4", hjust = 0.94))+ * theme(axis.title.x = * element_text(size = 12, hjust = 0, * color = "steelblue4", * face = "bold")) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_08_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ theme(plot.title = element_text(size = 18, hjust = 0, color = "steelblue4", face = "bold"))+ theme(plot.subtitle = element_text(size = 12, color = "darkgoldenrod2", hjust = 0, face = "bold"))+ theme(plot.caption = element_text(color = "steelblue4", hjust = 0.94))+ theme(axis.title.x = element_text(size = 12, hjust = 0, color = "steelblue4", face = "bold"))+ * theme(axis.text.x = * element_text(size = 10, * color = "steelblue4", * hjust = 0.5)) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_09_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ theme(plot.title = element_text(size = 18, hjust = 0, color = "steelblue4", face = "bold"))+ theme(plot.subtitle = element_text(size = 12, color = "darkgoldenrod2", hjust = 0, face = "bold"))+ theme(plot.caption = element_text(color = "steelblue4", hjust = 0.94))+ theme(axis.title.x = element_text(size = 12, hjust = 0, color = "steelblue4", face = "bold"))+ theme(axis.text.x = element_text(size = 10, color = "steelblue4", hjust = 0.5))+ * theme( * axis.line.y = element_blank(), * axis.text.y = element_blank(), * axis.ticks.y= element_blank(), * axis.ticks.x = element_blank(), * axis.line.x = element_blank()) ``` ] .panel2-plot2-auto[ ![](unemployment_files/figure-html/plot2_auto_10_output-1.png)<!-- --> ] --- count: false Building the Theme .panel1-plot2-auto[ ```r plot+ theme(panel.background = element_rect(fill = "grey99"))+ theme(plot.background = element_rect(fill = "grey99"))+ theme(panel.grid = element_blank())+ theme(plot.title = element_text(size = 18, hjust = 0, color = "steelblue4", face = "bold"))+ theme(plot.subtitle = element_text(size = 12, color = "darkgoldenrod2", hjust = 0, face = "bold"))+ theme(plot.caption = element_text(color = "steelblue4", hjust = 0.94))+ theme(axis.title.x = element_text(size = 12, hjust = 0, color = "steelblue4", face = "bold"))+ theme(axis.text.x = element_text(size = 10, color = "steelblue4", hjust = 0.5))+ theme( axis.line.y = element_blank(), axis.text.y = element_blank(), axis.ticks.y= element_blank(), axis.ticks.x = element_blank(), axis.line.x = element_blank())-> * plot2 ``` ] .panel2-plot2-auto[ ] <style> .panel1-plot2-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-plot2-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-plot2-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- # Faceting This intermediate step is not necessary, but in order to demostrate clearly how the plot will be built, we will facet by year using facet_wrap() to create an individual plot for each year. This will allow us to see how the bar lengths vary and add annotations before adding animations --- count: false Faceting .panel1-plot3-auto[ ```r *plot2 ``` ] .panel2-plot3-auto[ ![](unemployment_files/figure-html/plot3_auto_01_output-1.png)<!-- --> ] --- count: false Faceting .panel1-plot3-auto[ ```r plot2+ * facet_wrap(~ TIME, nrow=3) ``` ] .panel2-plot3-auto[ ![](unemployment_files/figure-html/plot3_auto_02_output-1.png)<!-- --> ] --- count: false Faceting .panel1-plot3-auto[ ```r plot2+ facet_wrap(~ TIME, nrow=3)+ * geom_col(fill = "steelblue4", * width = 0.75, * alpha = 0.9) ``` ] .panel2-plot3-auto[ ![](unemployment_files/figure-html/plot3_auto_03_output-1.png)<!-- --> ] --- count: false Faceting .panel1-plot3-auto[ ```r plot2+ facet_wrap(~ TIME, nrow=3)+ geom_col(fill = "steelblue4", width = 0.75, alpha = 0.9)+ * annotate(x=0, xend=65, * y=15, yend=15, * colour="steelblue4", * geom="segment", * size = 2) ``` ] .panel2-plot3-auto[ ![](unemployment_files/figure-html/plot3_auto_04_output-1.png)<!-- --> ] --- count: false Faceting .panel1-plot3-auto[ ```r plot2+ facet_wrap(~ TIME, nrow=3)+ geom_col(fill = "steelblue4", width = 0.75, alpha = 0.9)+ annotate(x=0, xend=65, y=15, yend=15, colour="steelblue4", geom="segment", size = 2)+ * annotate(x = 25, xend = 25, * y = 14.9, yend = 0.5, * size = 1, geom="segment", * color = "darkgoldenrod2", * linetype = "dashed") ``` ] .panel2-plot3-auto[ ![](unemployment_files/figure-html/plot3_auto_05_output-1.png)<!-- --> ] --- count: false Faceting .panel1-plot3-auto[ ```r plot2+ facet_wrap(~ TIME, nrow=3)+ geom_col(fill = "steelblue4", width = 0.75, alpha = 0.9)+ annotate(x=0, xend=65, y=15, yend=15, colour="steelblue4", geom="segment", size = 2)+ annotate(x = 25, xend = 25, y = 14.9, yend = 0.5, size = 1, geom="segment", color = "darkgoldenrod2", linetype = "dashed")+ * annotate(x = 50, xend = 50, * y = 14.9, yend = 0.5, * size = 1, geom="segment", * color = "darkgoldenrod2", * linetype = "dashed") ``` ] .panel2-plot3-auto[ ![](unemployment_files/figure-html/plot3_auto_06_output-1.png)<!-- --> ] --- count: false Faceting .panel1-plot3-auto[ ```r plot2+ facet_wrap(~ TIME, nrow=3)+ geom_col(fill = "steelblue4", width = 0.75, alpha = 0.9)+ annotate(x=0, xend=65, y=15, yend=15, colour="steelblue4", geom="segment", size = 2)+ annotate(x = 25, xend = 25, y = 14.9, yend = 0.5, size = 1, geom="segment", color = "darkgoldenrod2", linetype = "dashed")+ annotate(x = 50, xend = 50, y = 14.9, yend = 0.5, size = 1, geom="segment", color = "darkgoldenrod2", linetype = "dashed")-> * plot3 ``` ] .panel2-plot3-auto[ ] <style> .panel1-plot3-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-plot3-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-plot3-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false Adding the Animation .panel1-plot4-user[ ```r *plot3 ``` ] .panel2-plot4-user[ ![](unemployment_files/figure-html/plot4_user_01_output-1.png)<!-- --> ] --- count: false Adding the Animation .panel1-plot4-user[ ```r plot3+ * facet_null()+ * gganimate::transition_time(TIME) ``` ] .panel2-plot4-user[ ![](unemployment_files/figure-html/plot4_user_02_output-1.gif)<!-- --> ] --- count: false Adding the Animation .panel1-plot4-user[ ```r plot3+ facet_null()+ gganimate::transition_time(TIME)+ * ease_aes('linear') ``` ] .panel2-plot4-user[ ![](unemployment_files/figure-html/plot4_user_03_output-1.gif)<!-- --> ] --- count: false Adding the Animation .panel1-plot4-user[ ```r plot3+ facet_null()+ gganimate::transition_time(TIME)+ ease_aes('linear')+ * labs(x = 'Year: {format(round(frame_time, digits = 0))}')+ * geom_text(aes(label = reorder(Country, Value)), * x = 0.1, hjust = 0, color = "grey99", * fontface = "bold") ``` ] .panel2-plot4-user[ ![](unemployment_files/figure-html/plot4_user_04_output-1.gif)<!-- --> ] --- count: false Adding the Animation .panel1-plot4-user[ ```r plot3+ facet_null()+ gganimate::transition_time(TIME)+ ease_aes('linear')+ labs(x = 'Year: {format(round(frame_time, digits = 0))}')+ geom_text(aes(label = reorder(Country, Value)), x = 0.1, hjust = 0, color = "grey99", fontface = "bold")+ * geom_text(aes(label = * format(round(Value, digits = 0))), * x = 63, color = "steelblue4", * fontface = "bold", hjust = 1) ``` ] .panel2-plot4-user[ ![](unemployment_files/figure-html/plot4_user_05_output-1.gif)<!-- --> ] --- count: false Adding the Animation .panel1-plot4-user[ ```r plot3+ facet_null()+ gganimate::transition_time(TIME)+ ease_aes('linear')+ labs(x = 'Year: {format(round(frame_time, digits = 0))}')+ geom_text(aes(label = reorder(Country, Value)), x = 0.1, hjust = 0, color = "grey99", fontface = "bold")+ geom_text(aes(label = format(round(Value, digits = 0))), x = 63, color = "steelblue4", fontface = "bold", hjust = 1)+ * geom_text(x=63.5, label = "%", color = "steelblue4", * fontface = "bold", hjust = 0) ``` ] .panel2-plot4-user[ ![](unemployment_files/figure-html/plot4_user_06_output-1.gif)<!-- --> ] --- count: false Adding the Animation .panel1-plot4-user[ ```r plot3+ facet_null()+ gganimate::transition_time(TIME)+ ease_aes('linear')+ labs(x = 'Year: {format(round(frame_time, digits = 0))}')+ geom_text(aes(label = reorder(Country, Value)), x = 0.1, hjust = 0, color = "grey99", fontface = "bold")+ geom_text(aes(label = format(round(Value, digits = 0))), x = 63, color = "steelblue4", fontface = "bold", hjust = 1)+ geom_text(x=63.5, label = "%", color = "steelblue4", fontface = "bold", hjust = 0)-> * finalplot ``` ] .panel2-plot4-user[ ] <style> .panel1-plot4-user { color: black; width: 45.8723404255319%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-plot4-user { color: black; width: 52.1276595744681%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-plot4-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ![](unemployment_files/figure-html/finplot_auto_01_output-1.gif)<!-- --> --- count: false ![](unemployment_files/figure-html/finplot_auto_02_output-1.gif)<!-- --> <style> .panel1-finplot-auto { color: black; width: 99%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-finplot-auto { color: black; width: NA%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-finplot-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> <style type="text/css"> .remark-code{line-height: 1.2; font-size: 73%} @media print { .has-continuation { display: block; } } </style>