## Statistical Science

### Reactive Programming for Interactive Graphics

#### Abstract

One of the big challenges of developing interactive statistical applications is the management of the data pipeline, which controls transformations from data to plot. The user’s interactions needs to be propagated through these modules and reflected in the output representation at a fast pace. Each individual module may be easy to develop and manage, but the dependency structure can be quite challenging. The MVC (Model/View/Controller) pattern is an attempt to solve the problem by separating the user’s interaction from the representation of the data. In this paper we discuss the paradigm of reactive programming in the framework of the MVC architecture and show its applicability to interactive graphics. Under this paradigm, developers benefit from the separation of user interaction from the graphical representation, which makes it easier for users and developers to extend interactive applications. We show the central role of reactive data objects in an interactive graphics system, implemented as the R package cranvas, which is freely available on GitHub and the main developers include the authors of this paper.

#### Article information

Source
Statist. Sci., Volume 29, Number 2 (2014), 201-213.

Dates
First available in Project Euclid: 18 August 2014

https://projecteuclid.org/euclid.ss/1408368571

Digital Object Identifier
doi:10.1214/14-STS477

Mathematical Reviews number (MathSciNet)
MR3264532

Zentralblatt MATH identifier
1332.62010

#### Citation

Xie, Yihui; Hofmann, Heike; Cheng, Xiaoyue. Reactive Programming for Interactive Graphics. Statist. Sci. 29 (2014), no. 2, 201--213. doi:10.1214/14-STS477. https://projecteuclid.org/euclid.ss/1408368571

#### References

• Asimov, D. (1985). The grand tour: A tool for viewing multidimensional data. SIAM J. Sci. Statist. Comput. 6 128–143.
• Bostock, M., Ogievetsky, V. and Heer, J. (2011). $\mathrm{D}^{3}$ data-driven documents. IEEE Transactions on Visualization and Computer Graphics 17 2301–2309.
• Buja, A., Asimov, D., Hurley, C. and McDonald, J. A. (1988). Elements of a viewing pipeline for data analysis. In Dynamic Graphics for Statistics 277–308. Wadsworth & Brooks/Cole, Belmont, CA.
• Chambers, J. (2013). Objects with fields treated by reference (OOP-style). See help(ReferenceClasses) in R.
• Cook, D. and Swayne, D. F. (2007). Interactive and Dynamic Graphics for Data Analysis with R and GGobi. Springer, Berlin.
• Dykes, J. (1998). Cartographic visualization: Exploratory spatial data analysis with local indicators of spatial association using Tcl/Tk and cdv. Journal of the Royal Statistical Society: Series D (The Statistician) 47 485–497.
• Fisherkeller, M. A., Friedman, J. H. and Tukey, J. W. (1988). PRIM-9: An interactive multidimensional data display and analysis system. In Dynamic Graphics for Statistics 91–109. Wadsworth & Brooks/Cole, Belmont, CA.
• Hurley, C. and Oldford, R. W. (1988). Higher hierarchical views of statistical objects. Available from the video library of the ASA sections on Statistical Graphics: http://stat-graphics.org/movies/.
• Krasner, G. E. and Pope, S. T. (1988). A cookbook for using the model-view controller user interface paradigm in Smalltalk-80. Journal of Object-Oriented Programming 1 26–49.
• Lawrence, M. and Sarkar, D. (2013a). qtbase: Interface between R and Qt. R package version 1.0.6.
• Lawrence, M. and Sarkar, D. (2013b). qtpaint: Qt-based painting infrastructure. R package version 0.9.0.
• Lawrence, M. and Temple Lang, D. (2010). RGtk2: A graphical user interface toolkit for R. Journal of Statistical Software 37 1–52.
• Lawrence, M. and Wickham, H. (2012). plumbr: Mutable and dynamic data models. R package version 0.6.6.
• Lawrence, M. and Yin, T. (2011). Mutable signal objects. R package version 0.10.2.
• Leff, A. and Rayfield, J. T. (2001). Web-application development using the model/view/controller design pattern. In IEEE Enterprise Distributed Object Computing Conference 118–127. IEEE.
• McDonald, J. A., Stuetzle, W. and Buja, A. (1990). Painting multiple views of complex objects. In ACM SIGPLAN Notices 25 245–257. ACM, New York.
• Qt Project (2013). A cross-platform application and UI framework. Available at http://qt-project.org/.
• R Core Team (2013). R: A Language and Environment for Statistical Computing. R Core Team, Vienna, Austria.
• Rosling, H. and Johansson, C. (2009). Gapminder: Liberating the X-axis from the burden of time. Statistical Computing and Statistical Graphics Newsletter 20 4–7.
• RStudio, Inc. (2013). Easy web applications in R. Available at http://www.rstudio.com/shiny/.
• SAS Institute (2009). JMP 8 Statistics and Graphics Guide. SAS Publishing, Cary, NC.
• Shneiderman, B. (1983). Direct manipulation: A step beyond programming languages. Computer 16 57–69.
• Stuetzle, W. (1987). Plot Windows. J. Amer. Statist. Assoc. 82 466–475.
• Swayne, D. F. and Klinke, S. (1999). Introduction to the Special issue on interactive graphical data analysis: What is interaction? Comput. Statist. 14 1–6.
• Swayne, D. F., Temple Lang, D., Buja, A. and Cook, D. (2003). GGobi: Evolving from XGobi into an extensible framework for interactive data visualization. Comput. Statist. Data Anal. 43 423–444.
• Theus, M. (2002). Interactive data visualization using Mondrian. Journal of Statistical Software 7 1–9.
• Tierney, L. (1990). LISP-STAT: An Object-Oriented Environment for Statistical Computing and Dynamic Graphics. Wiley, New York.
• Tierney, L. (2005). Some notes on the past and future of LISP-STAT. Journal of Statistical Software 13 1–15.
• Unwin, A. R., Hawkins, G., Hofmann, H. and Siegl, B. (1996). Interactive graphics for data sets with missing values—MANET. J. Comput. Graph. Statist. 5 113–122.
• Urbanek, S. and Wichtrey, T. (2013). iplots: iPlots—Interactive graphics for R. R package version 1.1-5.
• Velleman, P. F. and Velleman, A. Y. (1988). Data Desk Handbook. Odesta Corporation, Northbrook, IL.
• Verzani, J. and Lawrence, M. F. (2012). Programming Graphical User Interfaces in R. Chapman & Hall/CRC, London.
• Viegas, F. B., Wattenberg, M., Van Ham, F., Kriss, J. and McKeon, M. (2007). Manyeyes: A site for visualization at internet scale. IEEE Transactions on Visualization and Computer Graphics 13 1121–1128.
• Whalen, E. (2005). Creating linked, interactive views to explore multivariate data. Ph.D. thesis, Harvard Univ.
• Wickham, H., Lawrence, M., Temple Lang, D. and Swayne, D. F. (2008). An introduction to rggobi. R News 8 3–7.
• Wickham, H., Lawrence, M., Cook, D., Buja, A., Hofmann, H. and Swayne, D. F. (2009). The plumbing of interactive graphics. Comput. Statist. 24 207–215.
• Wickham, H., Cook, D., Hofmann, H. and Buja, A. (2011). tourr: An R package for exploring multivariate data with projections. Journal of Statistical Software 40 1–18.
• Wills, G. J. (1999). Interactive statistical graphics. In Handbook of Data Mining and Knowledge Discovery. Oxford Univ. Press, London.
• Wolfe, J. M., Kluender, K. R. and Levi, D. M. (2012). Sensation and Perception, 3rd ed. Sinauer, Sunderland.
• Xie, Y., Hofmann, H., Cook, D., Cheng, X., Schloerke, B., Vendettuoli, M., Yin, T., Wickham, H. and Lawrence, M. (2013). cranvas: Interactive statistical graphics based on Qt. R package version 0.8.3. Available at http://cranvas.org.