Maintainer: | Sherry Zhang, Dianne Cook, Ian Lyttle |
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, Ian Lyttle (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.
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.
The plotly package (plotly.js) creates the graphics from the native plotly syntax: initialize with plot_ly()
, specify shapes (markers, lines, etc.) through add_*()
, control axes and legends with layout()
, and color with colorbar()
. Variables are specified with a ~
upfront. Every plotly
plot includes a toolbar that allows panning and zooming, box/lasso selection, saving and supports brushed linking across multiple data plots. It also supports click on categorical legend to show/hide categories. The plotly
package also supports converting ggplot2 objects directly into interactive plots via the ggplotly()
function. Animation through plotly
is introduced under the Animation section. See Carson Sievert’s book Interactive web-based data visualization with R, plotly, and shiny for more details.
The ggiraph package is an extension to ggplot2
for interactive graphics by providing interactive versions of the geom
, scale
, facet
, guide
, and theme
functions/elements. The interactivity allows for customized tooltips with JS code, as well as hover and click effects.
In echarts4r (echarts.js), a plot is initialized by e_charts()
and different plot elements (shapes, axes, theme, etc.) are built with the e_*
functions, e.g. e_line()
, e_axis_labels()
, e_theme()
. It covers most basic chart types, statistical graphics (confidence band, correlation matrix, etc.), geospatial maps, some timeline (time series) displays, and network diagrams. WebGL render is also supported, as well as using customized icons/pictures in the plot. A unique interactive action supported by the package is to drag the end of the color/fill legend to filter the data within the range on the plot (see e_visual_map()
).
In highcharter (highcharts.js), a plot is initialized by hchart()
or built with hc_add_series()
. Plot elements (legend, color, axis, etc.) are adjusted using the hc_*()
functions. The package supports visualizing maps, network diagrams, and statistical plots (e.g., PCA plot after princomp()
, correlation matrix). For temporal plots, it supports linked tracking across multiple series and zooming at various scales, through button clicking or dragging on the subchart. It also supports clicking to view the treemap at different hierarchical levels.
In billboarder (billboard.js ), a plot is initialized by billboarder()
and plot elements (shape, axes, legend, etc.) are specified through bb_*()
functions. Zooming on time series plots is supported by selecting the main plot (bb_zoom()
) or a subchart (bb_subchart()
).
googleVis (Google Charts) uses the syntax, gvis[ChartType]()
, rather than a grammar to specify the plot, e.g., gvisScatterChart()
. Additional controls of plot elements are passed as a list of options
inside the main function. It supports creating maps, interactive tables, treemaps, network and Sankey diagrams, and calendar plots.
rAmCharts and rAmCharts4 (amcharts.js) uses the syntax amChartType()
to specify the plot. It supports the selection of multiple datasets through the selection box, see amStockMultiSet()
.
ggvis follows the grammar of graphics in ggplot2
to express interactive graphics for general purpose exploratory data analysis. Notice that although the package is currently listed on CRAN, it is labelled as dormant by its developers on GitHub.
RJSplot allows easy the generation of interactive graphics. RJSplot includes eleven graphs, such as a genome browser, Manhattan plot, genome map, network browser, heatmap, scatter plot, etc. Some live examples and tutorials can be seen on the project Web site: https://rjsplot.usal.es.
The gganimate package extends the grammar of graphics in ggplot2
to describe animations. It provides functions to specify transition between frames (transition_*()
), appearance and disappearance of data (enter_*()/ exit_*()
), among others.
The plotly package supports animation through specifying a frame
(and ids
) aesthetic in the graphical element (markers, lines, etc.).
The animate package supports creating animations using base R syntax and is powered by D3.js.
The animation package provides a gallery of animated illustrations of common statistical concepts, such as bootstrapping and the Central Limit Tehorem (CLT), designed for teaching purposes.
One of the most common visualizations for high dimension data is scatterplot matrix.
It can be created with GGally::ggpairs()
and turned into interactive using plotly::ggplotly()
to enable linked brushing to view the data at different variable combinations.
The pairsD3 package creates scatterplot matrices through D3.js.
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.
tourr implements varies tourr types (grand_tour
, guided_tour
, planned_tour
, local_tour
, etc.) and displays (animate_xy
: 2D, animate_dist
: 1D, etc.) to create frame-by-frame animation.
spinifex implements the manual tourr algorithm (manual_tour
).
liminal implements linked display view to understanding embedding algorithms such as tSNE through vegawidget.
detourr implements the 2D and 3D scatterplot display with three.js for better interactive manipulations (rotation, pan, selection, brushing with color and time control).
langevitour implements the Langevin dynamics to generate projection sequence and builds the display with D3.js.
woylier implements the Given interpolation method to generate projection sequences for rotation variant projection pursuit indexes (those index values change when rotating the projection within the plane), e.g., the spline index.
ferrn provides diagnostic plots (track index values and visualize the basis space) to the optimization routine of the projection pursuit guided tour.
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.
The tsibbletalk package creates shared tsibble
objects to generate linked plots of time series and other plots within the crosstalk framework.
The dygraphs package (dygraphs.js) creates interactive time series plots for xts
objects and supports interactive features including series highlights, value tracking, annotating event and confidence interval, range selection, and rolling window smoothing.
The timevis package (vis.js) creates timeline visualization for project management and event scheduling. It supports dragging and zooming on the time axis and is compatible with crosstalk
for linked brushing.
The plotly package provides functionality for general-purpose interactive maps that fit into the plotly
ecosystem, supporting features like linked brushing. Simple, quick basemaps can be created with the plot_mapbox()
and plot_geo()
constructor. For more complex, data-driven maps (e.g., with sf
), use the plot_ly()
constructor or ggplotly()
on a ggplot2
object.
The ggiraph package supports converting ggplot2
objects into interactive graphs. It allows flexible customization options for interactivity, including tooltip text, onclick effects, CSS for hover and select, allowing additional information to be incorporated into the visualization (e.g., linking to an external website upon clicking).
The highcharter package supports maps created from data frames/tibbles and the geo_json
class from the geojsonio
package. It allows customization of tooltips and enables legend clicking to show or hide categories.
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:
The tmap package provides a ggplot2-styled grammar of graphic for thematic maps (both static and interactive) and uses leaflet to render interactive maps.
The mapview package creates quick leaflet and mapdeck maps with short syntax from common spatial classes in R such as sf
, raster
, and stars
.
The mapboxer package interfaces with Mapbox GL JS to create interactive maps. It leverages resources from the JS library for basemap styles, aesthetics controls, interactive controls, including interactive filtering (“expressions”) and point clustering.
The deckgl package interfaces with deck.gl for interactive maps. It offers an interactive editor to fine tune the map (add_json_editor()
).
The mapdeck package interactive visualization for large data sets via Mapbox GL and deck.gl. It supports a wider set of objects including data frame, sf (sfencoded, sfencodedLite), geojson/json/GeoJSON.
The evolMap package provides interactive and temporal maps with a GUI which enable the exploration of information and customization of visual aspects. Represents and manages information from a database on an interactive geographic map. It also allows to view the evolution of the added elements over time or in periods. Tutorials can be seen on the developer Github: https://github.com/BioinfoUSAL/VisualAnalyticsWorkshop.
Packages are available for plotting simple networks:
The sigmajs package has its own grammar for constructing network diagrams. It supports data structure from igraph
and gexf
and can use various igraph
layouts to display the network. The package has also implemented plugins from the sigma.js
, which includes highlight neighbor nodes and apply customized images for nodes.
The networkD3 package (D3.js) produces simple/force network, Sankey diagram, dendrogram. The visualization can be created from igraph
objects.
The visNetwork package (vis.js) creates network diagrams through node and edge data frames. It supports visualizing classification tree results from the rpart
package.
The collapsibleTree package creates collapsible tree diagram to visualize hierarchical data structures based on D3.js. It supports clicking on tree nodes to expand and collapse child nodes, as well as tooltips and zooming.
The rD3plot package creates interactive, temporal networks with a GUI which enable the exploration of information and customization of visual aspects. Represents and manages information from a database about a network. It also allows you to view the evolution of the added elements. It provides node search, filter, display customization, playback controls and bar charts. Information can be explored on a table, tool tips and information window. Tutorials can be seen on the developer Github: https://github.com/BioinfoUSAL/VisualAnalyticsWorkshop.
R also includes packages dedicated to specific interactive visualizations, often by interfacing with relevant JS libraries.
The trelliscopejs package (trelliscope.js) enables the interactive visualization of small multiples, making it particularly suitable for visualizing large collections of multiples that cannot be displayed on a single screen through facets. The package offers facet_trelliscope()
, as a drop-in replacement for facet_wrap()
/facet_grid()
, as well as trelliscope()
, a more general function that fits into the tidy workflow where data transformation (compute summaries, models, etc.) can be handled by nested data and list-column.
The heatmaply package (plotly.js) allows interactive heatmaps with actions like cell-hover tooltips and zooming into specific areas. It supports data transformations such as scaling, normalizing, and percentizing, and the dendrograms for viewing the structure of observations can be customized using the dendextend
package.
The iheatmapr package (plotly.js) supports heatmaps with more complex subplots in addition to clustering dendrograms. It includes annotations for group categories and customizable plots for row and column summary statistics. It also supports displaying multiple heatmaps side-by-side.
The tcltk
package (part of base packages) provides access to the platform-independent Tcl scripting language and Tk GUI elements, forming the basis for other packages.
The rgl package provides 3D visualizations built with OpenGL or WebGL as the rendering backend.
Core: | crosstalk, gganimate, ggiraph, leaflet, plotly. |
Regular: | animate, animation, billboarder, collapsibleTree, ddplot, deckgl, detourr, dygraphs, echarts4r, evolMap, ferrn, ggvis, googleVis, heatmaply, highcharter, iheatmapr, langevitour, leafem, leafgl, leaflegend, leaflet.minicharts, leafpop, leafsync, liminal, loon, mapboxer, mapdeck, mapview, networkD3, pairsD3, parallelPlot, r2d3, rAmCharts, rAmCharts4, rD3plot, rgl, RJSplot, sigmajs, spinifex, timevis, tmap, tourr, trelliscopejs, tsibbletalk, vegawidget, visNetwork, woylier. |