scieee AI-readable full text Open interactive document viewer

Making Statistical Interactive Graphics Ubiquitous

Urbanek, Simon; Bartonicek, Adam

Abstract

Interactive graphics are invaluable for data exploration, yet remain challenging to implement and share for casual users. This is further exacerbated by an apparent split within the interactive data visualization community. On one hand, statisticians have been developing sophisticated interactive data visualization tools for decades; however, these have often come in the form of stand-alone applications, which has made them more difficult to extend and disseminate. On the other hand, frameworks developed with web technologies have emerged as a highly accessible and portable alternative, yet some of the insights and features from statistical interactive graphics research have been lost. This paper presents Plotscape, a software which combines core features of statistical graphics with the accessibility of the web-based visualizations. It is provided as a TypeScript library which can be used to generate self-contained, interactive HTML documents for easy dissemination and integration into interactive reports. For ease of use we also provide an R package plotscaper enabling easy use from the R programming language. We provide overview of the system’s design, the R programming language interface, and demonstrate its utility through illustrative examples.

Full text

Making Statistical Interactive Graphics Ubiquitous Simon Urbanek1and Adam Bartonicek1 1University of Auckland, New Zealand October 17, 2025 Abstract Interactive graphics are invaluable for data exploration, yet remain challenging to implement and share for casual users. This is further exacerbated by an apparent split within the interactive data visualization community. On one hand, statisticians have been developing sophisticated interactive data visualization tools for decades; however, these have often come in the form of stand-alone applications, which has made them more difficult to extend and disseminate. On the other hand, frameworks developed with web technologies have emerged as a highly accessible and portable alternative, yet some of the insights and features from statistical interactive graphics research have been lost. This paper presents Plotscape, a software which combines core features of statistical graphics with the accessibility of the web-based visualizations. It is provided as a TypeScript library which can be used to generate self-contained, interactive HTML documents for easy dissemination and integration into interactive reports. For ease of use we also provide an R package plotscaper enabling easy use from the R programming language. We provide overview of the system’s design, the R programming language interface, and demonstrate its utility through illustrative examples. Keywords: visualization, interactive graphics, statistical graphics, R 1 1 Introduction Graphics are fundamental to understanding data. They can be broadly grouped into two primary categories: presentation graphics, designed to convince and to convey known findings, and exploratory graphics, which enable the discovery of new patterns and insights within data. The former is typically used in presentations and articles, while the latter is a cornerstone of exploratory data analysis (Tukey, 1977). And it is exploratory data analysis in particular where interactive graphics shine; to explore our data, we need to manipulate it and probe it. Interactive data visualization tools can supercharge this process, ”forcing us to notice that which we would never expect to see” (Tukey, 1977), particularly in the case of complex and multidimensional data sets. Yet, while interactive graphics offer distinct advantages, they also come with an inherent implementation complexity which provides barrier to adoption. For static visualization, there are many popular, well-established tools for building bespoke visualizations, such as those within the R project(R Core Team, 2025). However, the same is not true for interactive visualization. Despite a long history of rigorous research and development in the statistical community (which will be discussed in the next section), few interactive solutions have achieved the same level of widespread adoption as their static counterparts. This has likely been partly due to the form these solutions have taken; many have been provided as stand-alone software packages, limiting avenues for integration. In contrast, later-developed web-based interactive data visualization systems provided greater degree of flexibility and portability, which has lead to their widespread adoption. However, this has also come at a cost; since these packages were primarily designed for presentation graphics, they often lack out-of-the-box support for useful interactive features that were common in many traditional statistical graphics. Thus, to this day, creating complex and sophisticated interactive graphics still remains challenging for the average user. Comprehensive, interactive systems are relatively rare within the statistical community, though they are more prevalent in fields like information visualization and digital publishing, where reaching large audiences is paramount. To give a concrete example, the New York Times frequently employs web-based interactive graphics to enhance storytelling (Cox, 2012). These visualizations leverage interactivity to make them highly accessible, broadening the appeal of the data insights to a wider audience. There are numerous examples, but for illustration see Money, Race and Success: How Your School District Compares1which features 1https://www.nytimes.com/interactive/2016/04/29/upshot/ money-race-and-success-how-your-school-district-compares.html 2 interactive scatterplots with querying and search, or A 3-D View of a Chart That Predicts The Economic Future: The Yield Curve2which drives a 3D surface plot with a narrative. However, creating such visualizations is often labor-intensive, frequently requiring dedicated teams of developers. This makes creating such visualizations impractical for individual researchers or analysts. In this paper, we propose an alternative: a system built upon on solid foundation established by decades of statistical graphics research, implemented as a readily accessible web-based application. Plotscape can be used to create fully self-contained interactive graphics HTML documents, which can also be easily included in web-pages and reports. We will discuss the interface from the R programming language and demonstrate the system’s capabilities. We begin with a review of existing work in the field, followed by a description of our methodology, examples of its use, and concluding remarks. 2 Existing Work One of the earliest examples of interactive statistical data visualization systems was PRIM-9 (Fisherkeller et al., 1975), which allowed the user to interactively control projection in scatterplots. Subsequent systems introduced many other sophisticated features. Of these, of particular interest is linked highlighting and brushing, implemented in systems such as XLisp-Stat (Tierney, 1995), which enables users to quickly explore complex multivariate relationships within datasets by selecting objects in one plot and seeing the corresponding cases get highlighted in others. XGobi (Swayne et al., 1998) and GGobi (Swayne et al., 2003) expanded upon these concepts, providing additional features for exploring high-dimensional data such as grand tours. Further improvements to the user interface and additional interactions, such as reordering, sorting, and selection sequences, were implemented in Mondrian (Theus, 2002) (example in Figure 1). The iPlots R package (Urbanek and Theus, 2003) brought these interactive capabilities to the R programming environment. As discussed previously, other developments in interactive graphics came from the fields of information visualization and the web-development. Systems such as D3.js (Bostock, 2022) and Plotly (Plotly Inc., 2023) provided a highly flexible set of tools for developing interactive graphics on the web. However, these frameworks often lack some of the core features common in earlier statistical graphics systems For instance, Plotly provides a user-friendly interface for creating a variety of plots 2https://www.nytimes.com/interactive/2015/03/19/upshot/ 3d-yield-curve-economic-growth.html 3 Figure 1: Interactive visualization using Mondrian software (Theus, 2002) applied to olive oil fatty acid composition dataset (Forina et al., 1983). Interactive features applied were change of bin width and anchor in the linoleic fatty acid histogram, reduced opacity in scatterplot and parallel coordinate plots, re-ordered categories for semantic clarity, brushing with blue color applied to the Sardinia region and highlighting applied via selection sequence in the Region barchart to the North region. both in Python and R, but primarily only supports within-plot interactivity such as querying, zooming and panning. While between-plot interactive features like linked selection are possible, (using, for instance, dc.js (2018)), implementing them requires more programming effort and the resulting interactions can still behave in inconsistent ways. In D3.js, features like linked selection must be implemented entirely outside of the framework. In digital publishing, web-based interactive presentation graphics are becoming increasingly common. Amanda Cox’s work at the New York Times (Cox, 2012) exemplifies this trend, producing accessible and engaging visualizations that often drive the narrative. These visualizations (such as examples shown in the Introduc4 tion) can include interactive elements like search and highlighting, or 3D plots with navigation that dynamically change the view to reveal different aspects of the story. While effective, these visualizations are typically very labor-intensive to create. Thus, our goal is to create web-based interactive graphics that are guided by statistical principles, incorporate features from established stand-alone programs, and are easy to create from R. 3 Methods Creating interactive graphics presents several significant challenges. While the Grammar of Graphics (Wilkinson, 2005) provides a solid foundation for static graphics, with popular implementations such as the ggplot2 (Wickham, 2016) in R, extending this framework to support interactivity is not straightforward. Due to several important issues that will be discussed below, interactivity cannot be just added after the fact. A fundamental requirement for a statistical interactive graphics system is consistent handling of data transformations across partitions induced by linking, and the corresponding reactive propagation of changes. Many types of plots (such as histograms or barcharts) use geometric objects to represent aggregated summary statistics derived from the data, such as sums or counts. When the user engages in selection, we want to show the change in these underlying summaries. Typically, this is done by highlighting parts of objects (stacking), which has the distinct advantage of preserving certain visual invariants about the plot - since we know that highlighted part of an object can never grow outside of the bounds of the whole object, we do not have to recompute the axis limits. However, plots can also have individual parameters, such as the anchor point and bin width in histograms. Changes to these parameters affect larger parts of the plot, for instance, changing histogram bin width may change the height of the tallest bar, necessitating an update to the y-axis. Our design addresses these challenges through a layered approach. The central idea is that of a hierarchy of partitions. First, each plot induces partitions the data space into disjoint subsets which are aggregated into summary statistics and represented as whole objects. For instance, objects like points in scatterplots or bars in barplots or histograms partition the data space into subsets. These subsets are then further partitioned by selection/brushing, managed by the marker component, and represented as object segments or parts. Crucially, it can be shown that if statistics computed on these partitions have certain algebraic properties, they will form partwhole relationships which will result in consistent visualizations. Specifically, statistics which form monoids are suitable for single-assignment linked selection (selected 5 vs. not-selected), and statistics which form (algebraic) groups, they are suitable for multi-assignment brushing (Bartonicek et al., 2025). The final part of are scales and geoms similar to those in Grammar of Graphics, but they also need to be reactive to support interactivity. For example, zooming and panning only affects the scales and does not need to re-compute the partitioning or statistics. Plotscape is a TypeScript library that implements the core web-based interactive graphics functionality as described above. It was designed with minimal set of dependencies and can be deployed entirely stand-alone, embedded in a single HTML file. It can be used directly from JavaScript, but for ease of use we also provide an R package plotscaper which is available on the Comprehensive R Archive Network (CRAN) and provides a user-friendly front-end in R. It can be embedded as htmlwidgets (Vaidyanathan et al., 2021) in interactive sessions or HTML output such as RMarkdown (Xie et al., 2018) documents. 4 Examples Two fundamental concepts in plotscaper are the schema and the scene. The schema is an object which records a set of instructions required to create a given interactive figure. It holds information about the data, plots, and any additional layout or scale changes. Importantly, schema is immutable, meaning that it simply records the set of instructions necessary to create the figure, similar to object ggplot class (Wickham, 2016). Schemata can be created via the create schema() function, and plots can then be added to the schema by calling functions add ...plot() which take the existing schema and return an updated version. This allows for an intuitive use with the pipe |> operator. In the following example uses the penguins dataset(Gorman et al., 2014) in R to create a linked interactive figure with a scatterplot, barchart, fluctuation diagram, and a histogram: library(plotscaper) schema <- create_schema(penguins) |> add_scatterplot(c("body_mass", "flipper_length")) |> add_barplot("species") |> add_fluctplot(c("species", "sex")) |> add_histogram("bill_len") In contrast to the immutable schema, the scene is refers to the live, rendered visualization, which with the user can interact. Specifically, rendering the schema 6 object produces a self-contained HTML file/element which can be either opened in a web browser or included in an RMarkdown document or dashboard. This HTML element is called a scene and can be created from the schema by calling the render() function: (scene <- render(schema)) Importantly, the scene can also be interacted with directly from R. Using an underlying WebSockets connection, the user can call functions in a running R session, causing “live” programmatic updates to the scene directly from within the R environment. For example, it is possible to brush specific cases (rows) of the dataset using the assign cases() function or select cases for transient highlighting with the select cases() function. The following code brushes the male penguins with the default group (green) then selects those penguins with the bill length of more than 45 millimeters. The result can be seen in Figure 2. scene |> assign_cases(sex == "male") |> select_cases(bill_length > 45) Importantly, the reason why we emphasize the distinction between the scene and the schema is that most plotscaper functions can be used on either one. When called with schema as the first argument, they produce an updated version of the schema, whereas when called with scene as a first argument, they produce a live, mutable change to the figure. For instance, calling add scatterplot() on a schema simply adds an instruction to add a scatterplot when the figure is rendered, whereas calling it on a scene directly inserts the plot into the currently rendered figure. This gives the user the flexibility to choose their preferred workflow: they can work with the schema, maintaining an immutable ledger of instructions for replicating the exact state of the figure, engage in direct, mutable manipulation of the figure, or use any combination of the two approaches. 5 Conclusion We have presented Plotscaper, a new system designed to make interactive statistical graphics more accessible by leveraging web technologies. The system comprises two core components: Plotscape, a TypeScript library, and plotscaper, an R package. 7 Figure 2: Interactive visualization using the plotscaper R package applied to the penguins dataset. These are available on NPM3, and CRAN4and GitHub5, respectively. Plotscaper bridges the gap between statistical and web-based interactive graphics, offering a powerful and user-friendly solution for creating and disseminating interactive data exploration. Future work will focus on expanding the range of supported plot types, improving performance, and incorporating more advanced interactive features. References Bartonicek, A., Urbanek, S. and Murrell, P. (2025), ‘No more, no less than sum of its parts: Groups, monoids, and the algebra of graphics, statistics, and interac3https://www.npmjs.com/package/@abartonicek/plotscape 4http://cran.r-project.org/package=plotscaper 5https://github.com/bartonicek/plotscaper 8 tion’, Journal of Computational and Graphical Statistics 34(3), 1063–1074. doi: 10.1080/10618600.2024.2429708. Bostock, M. (2022), ‘D3.js - data-driven documents’. [Online; accessed 18. Oct. 2022]. URL: https://d3js.org Cox, A. (2012), ‘Visualizing data at the New York Times’. URL: https://www.slideshare.net/slideshow/amanda-cox-visualizing-data-at-thenew-york-times/8645646 dc.js (2018), ‘dc.js - dimensional charting library’. URL: https://dc-js.github.io/dc.js/ Fisherkeller, M. A., Friedman, J. H. and Tukey, J. W. (1975), PRIM-9: An interactive multi-dimensional data display and analysis system, in ‘ACM Pacific’. Forina, M., Armanino, C. and Lanteri, S. (1983), ‘Classification of olive oils from their fatty acid composition’, Food Research and Data Analysis . Gorman, K. B., Williams, T. D. and Fraser, W. R. (2014), ‘Ecological sexual dimorphism and environmental variability within a community of antarctic penguins (genus pygoscelis)’, PLOS ONE 9(3), 1–14. doi: 10.1371/journal.pone.0090081. Plotly Inc. (2023), ‘Plotly: Low-Code Data App Development’. [Online; accessed 15. Mar. 2023]. URL: https://plotly.com R Core Team (2025), R: A Language and Environment for Statistical Computing, R Foundation for Statistical Computing, Vienna, Austria. doi: 10.32614/R.manuals. URL: https://www.R-project.org/ Swayne, D. F., Cook, D. and Buja, A. (1998), ‘XGobi: Interactive dynamic data visualization in the X window system’, Journal of Computational and Graphical Statistics 7(1), 113–130. doi: 10.1080/10618600.1998.10474764. Swayne, D., Temple Lang, D., Buja, A. and Cook, D. (2003), ‘Ggobi: Evolving from xgobi into an extensible framework for interactive data visualization’, Computational Statistics & Data Analysis 43, 423–444. doi: 10.1016/S0167-9473(02)002864. 9