Tools for Interactive Visualization of Global Demographic Concepts in R


Data visualization is a core component of the demographer’s workflow, as visualizations are essential to communicate the findings of demographic research. Recent advances in interactive data visualization have made it easier to produce dynamic web-based graphics in a variety of computing environments, including R, a popular tool for demographers. This article illustrates how to produce interactive charts and maps of demographic data in R using Plotly and Shiny, two frameworks for web-based visualization. Data for the examples come from idbr, a new R package to download demographic indicators from the US Census Bureau’s International Data Base.

This is a preview of subscription content, access via your institution.

Fig. 1

Data source: US Census Bureau International Data Base

Fig. 2
Fig. 3

Data source: US Census Bureau International Data Base

Fig. 4
Fig. 5


  1. Abel, G. J., & Sander, N. (2014). Quantifying global international migration flows. Science, 343(6178), 1520–1522.

    Article  Google Scholar 

  2. Arel-Bundock, V. (2014). Countrycode: Convert country names and country codes.

  3. Chang, W., Cheng, J., Allaire, J., Xie, Y., & McPherson, J. (2015). Shiny: Web application framework for R.

  4. Dennett, A. (2015). Visualising migration: Online tools for taking us beyond the static map. Migration Studies, 3(1), 143–152.

    Article  Google Scholar 

  5. Healy, K., & Moody, J. (2014). Data visualization in sociology. Annual Review of Sociology, 40, 105–128.

    Article  Google Scholar 

  6. Howell, F. M., & Porter, J. R. (2013). Editorial welcome: Why spatial demography? Spatial Demography, 1(1), 1–2.

    Article  Google Scholar 

  7. Kirk, A. (2012). Data visualization: A successful design process. Birmingham: Packt Publishing.

    Google Scholar 

  8. Muenchen, B. (2016). R Passes SAS in scholarly use (finally)., June 8. Last accessed 7 July 2016.

  9. Plotly Technologies Inc. (2015).  Collaborative data science.  Montréal, QC.

  10. R Core Team (2015). R: A language and environment for statistical computing. R foundation for statistical computing, Vienna, Austria.

  11. Segel, E., & Heer, J. (2010). Narrative visualization: Telling stories with data. IEEE Transactions on Visualization and Computer Graphics, 16(6), 1139–1148.

    Article  Google Scholar 

  12. Sievert, C., Parmer, C., Hocking, T., Chamberlain, S., Ram, K., Corvellec, M., & Despouy, P. (2016). Plotly: Create interactive web graphics via plotly’s javascript graphing library.

  13. Sparks, C. (2013). Spatial analysis in R: Part 1: Getting data from the ACS into R and exploratory data analysis. Spatial Demography, 1(1), 131–139.

    Article  Google Scholar 

  14. Sparks, C. (2014). Measuring residential segregation using R: So long to factfinder. Spatial Demography, 2(1), 72–78.

    Article  Google Scholar 

  15. US Census Bureau. (2013). International data base population estimates and methodology.

  16. Vaidyanathan, R., Xie, Y., Allaire, J., Cheng, J, & Russell, K. (2015). htmlwidgets: HTML widgets for R.

  17. Walker, K. (2016). idbr: R Interface to the US Census Bureau International Data Base API. R package version 0.2.

  18. Wickham, H. (2016). ggplot2: Elegant graphics for data analysis (2nd ed.). New York: Springer.

    Book  Google Scholar 

  19. Wickham, H., & Francois, R. (2016). dplyr: A Grammar of data manipulation. R package version 0.5.0.

  20. Wilkinson, L. (2005). The Grammar of graphics (2nd ed.). New York: Springer.

    Google Scholar 

  21. Yau, N. (2013). Data points: Visualization that means something. Indianapolis: Wiley.

    Google Scholar 

Download references

Author information



Corresponding author

Correspondence to Kyle E. Walker.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Walker, K.E. Tools for Interactive Visualization of Global Demographic Concepts in R. Spat Demogr 4, 207–220 (2016).

Download citation


  • R
  • Demography
  • Global
  • Data visualization