CRAN Task View: Dynamic Visualizations and Interactive Graphics

Maintainer:Sherry Zhang, Dianne Cook
Contact:huizezhangsh at gmail.com
Version:2024-09-25
URL:https://CRAN.R-project.org/view=DynamicVisualizations
Source:https://github.com/cran-task-views/DynamicVisualizations/
Contributions:Suggestions and improvements for this task view are very welcome and can be made through issues or pull requests on GitHub or via e-mail to the maintainer address. For further details see the Contributing guide.
Citation:Sherry Zhang, Dianne Cook (2024). CRAN Task View: Dynamic Visualizations and Interactive Graphics. Version 2024-09-25. URL https://CRAN.R-project.org/view=DynamicVisualizations.
Installation:The packages from this task view can be installed automatically using the ctv package. For example, ctv::install.views("DynamicVisualizations", coreOnly = TRUE) installs all the core packages or ctv::update.views("DynamicVisualizations") installs all packages that are not yet installed and up-to-date. See the CRAN Task View Initiative for more details.

Dynamic visualizations include interactive graphics which offer the flexibility for users to interact with the plot, with mouse or cursor selection, for example. This can be useful to query additional details, such as using mouse-over to provide additional information about a point or line in the plot. For exploratory data analysis, it is beneficial to view and link multiple plots using highlighting or brushing. Most interactivity is provided by interfacing R with external libraries like JavaScript (JS). Dynamic visualizations also include animations which are generated by rendering successive frames in the plot window.

This CRAN task view maintains a list of the dynamic graphics packages, for making animations and interactive plots. Static plots are not within the scope of this CRAN task view, neither are graphics devices. Some packages that include only one or two functions to produce interactive plots or animations but are mostly focused on modeling methods or applications are typically not included. If you think that a package is missing from this list, you can post an issue or directly add using a pull request in the GitHub repository. Alternatively, you can contact the maintainer via e-mail.

The listed packages are grouped into general-purpose packages and those designed for specific applications: multivariate, temporal, maps, networks, and miscellaneous packages for specific plot types.

General purpose

The crosstalk package enables linked brushing across interactive plots created from htmlwidgets, rather than creating interactive plots itself. Linked brushing is an interactive action useful for viewing the data from multiple visualizations to identify clusters, outliers, or other structure in the data. Compatible widgets with the crosstalk framework include plotly and leaflet.

The r2d3 package binds raw D3.js codes to R data objects, allowing D3 code to run with R-native data objects. This approach offers full customization of interactive details using JS but requires writing JS code. Packages built on the r2d3 framework: ddplot creates animated histogram and line chart upon clicking, among other plot types.

The following packages can all create interactive graphics of basic types, including scatterplots, bar charts, histograms etc. Most packages offer support to highlight plot elements (dots, bars, lines, etc.) and display tooltips upon hovering. This review covers the syntax for plotting, as well as the interactive actions and plot types supported.

Animation

Multivariate

One of the most common visualizations for high dimension data is scatterplot matrix.

When the multivariate relationship is attributed to more than two variables, a scatterplot matrix becomes insufficient and a family of techniques, called tour, can be useful to explore the structure in high dimensional data. The tour technique animates a sequence of linear projections of high dimensional data and it has two components: (1) tour type: how the projection sequence is generated, and (2) display: how low-D projections are displayed. Different tours are available to select the projection sequences (grand tour: random selection, guided tour: based on projection pursuit, etc.). The most common display is histograms for 1D projections and scatterplots for 2D projections. Other higher-D displays are also available, including Chernoff faces.

Another class of interactive visualization in R is the loon toolkit. The graphic system is written in Tcl and accessed in R via the tcltk package.

The parallelPlot package (D3.js) creates parallel coordinate plots (PCP) and scatterplot matrices with linked brushing to hightlight points and ranges on the PCP axis.

Temporal

Maps

General purpose packages

Specialized map packages

The leaflet family

The leaflet package is one of the most popular JS libraries for interactive maps. It supports creating maps for a wide range of R objects, including data frames, sf, GeoJSON/TopoJSON, raster images from the terra or raster packages. The package allows flexible customization of display and interactive options: enhencing tooltips and labels with CSS, changing basemap styles and showing/hiding layers through clicking the legend, customized marker icons via URL links and Font Awesome, a variety of basemap options, (including Open Street Map, Stamen, Stadia, ESRI, and customized map tiles), distance and area calculation from clicking points on the map (with addMeasure()), a mini global map for zooming, just to name a few. Leaflet maps can cross-talk with other interactive visualizations through the crosstalk package. The ecosystem is further enhanced through plugins:

Others

Networks

Packages are available for plotting simple networks:

Miscellaneous

R also includes packages dedicated to specific interactive visualizations, often by interfacing with relevant JS libraries.

CRAN packages

Core:crosstalk, gganimate, ggiraph, leaflet, plotly.
Regular:animate, animation, billboarder, collapsibleTree, ddplot, deckgl, detourr, dygraphs, echarts4r, ferrn, googleVis, heatmaply, highcharter, iheatmapr, langevitour, leafem, leafgl, leaflegend, leaflet.minicharts, leafpop, leafsync, liminal, loon, mapboxer, mapdeck, mapview, networkD3, pairsD3, parallelPlot, r2d3, rAmCharts, rAmCharts4, rgl, sigmajs, spinifex, timevis, tmap, tourr, trelliscopejs, tsibbletalk, vegawidget, visNetwork.
Archived:leaflet.multiopacity, woylier.

Related links