## Animations generated in R version 3.2.1 (2015-06-18) using the package
##   animation
library(plotrix)
library(animation)
for (y in unique(population$year)) {
    pop_year <- subset(population, year == y & age %in% ages)
    female <- pop_year$female_pct
    male <- pop_year$male_pct
    par(cex = 0.8)
    par(mar = pyramid.plot(male, female, top.labels = c("Male", 
        "", "Female"), labels = ages, main = y, lxcol = "#A097CC", 
        rxcol = "#EDBFBE", xlim = c(10, 10), gap = 0, unit = ""))
}
## R version 3.2.1 (2015-06-18)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Other packages: plotrix 3.5-12, animation 2.4