The code for the plot is on Github while I suggest to prettify it using my previous theme.
for(i in 1962:2015){ p <- ggplot(mydf_filter[mydf_filter$year==i,], aes(fert, life, size = pop, fill=continent)) + labs(x="Fertility Rate", y = "Life expectancy at birth (years)", size = "Population (millions)") + xlim(0,10) + ylim(30,100) + geom_point(alpha=.8,shape = 21 ) + scale_color_brewer(type = 'div', palette = 'Spectral') + annotate("text", label=i, x=9, y=95, size=8.5) + scale_size(range = c(1,20), name="Population (M)", breaks=c(1,100, 10000)) fn <- paste("/Users/xxx/Desktop/X/",str_pad(i-1961, 3, pad = "0"),".png",sep="") ggsave(p, file=fn, width = 9, height = 6) } # ffmpeg -framerate 5 -i /Users/xxx/Desktop/X/%3d.png -r 5 -pix_fmt yuv420p -y /Users/xxx/Desktop/X/Rosling.mp4