The animint2 Manual by Toby Dylan Hocking


Welcome to the animint2 manual web site!

This manual explains how to design and create interactive data visualizations using the R package animint2. The chapters of this manual are organized as follows.

The animint2 extensions to the grammar of graphics

The first seven chapters should be read sequentially, since they give a step by step guide to interactive data visualization using animint2.

Chapter 1 gives an overview of data analysis and visualization. It provides motivation and a theoretical foundation for the other chapters, and should be especially useful for readers who are completely new to data analysis. It introduces the method of data visualization prototyping using sketches, without introducing R code.

Starting with chapter 2, we will show how plot sketches can be translated into R code. Chapter 2 explains the basics of plotting using ggplots and animint2, and should be most useful for readers who have never used ggplot2. It explains how standard ggplots can be rendered on web pages using animint2.

Chapter 3 introduces showSelected, one of the two main keywords that animint2 introduces for interactive data visualization design. Chapter 3 begins by explaining selection variables, which provide the mechanism of interaction in animint2. Chapter 3 then explains how the showSelected keyword makes it possible to plot data subsets. Chapter 3 also explains how to use smooth transitions and animation.

Chapter 4 introduces clickSelects, the other main keyword that animint2 introduces for interactive data visualization design. The clickSelects keyword makes it possible for the user to change a selection variable by directly clicking on a plot element.

Chapter 5 explains several different ways to share your interactive data visualizations on the web.

Chapter 6 covers some other features of animint2, including how to specify hyperlinks, tooltips, data-driven selector variable names.

Chapter 7 covers the limitations of the current implementation of the animint2 R package, and explains workarounds for some common issues. It also includes some ideas for improvements, for those who would like to contribute to animint2.

Examples

The remaining chapters can be read in any order, since each chapter explains how to make data visualizations for a particular data set.

Chapter 8 explains how to create a multi-panel interactive World Bank data visualization.

Chapter 9 shows a visualization of data from cyclists in Montreal.

Chapter 10 explains how to create an interactive re-design of the nearest neighbors data visualization from the Elements of Statistical Learning book by Hastie et al.

Chapter 11 shows a data visualization that explains the Lasso, a machine learning model for regularized regression.

Chapter 12 shows a data visualization that explains support vector machines (SVM), a machine learning model for binary classification.

Chapter 13 explains how to create an interactive visualization that explains the Poisson regression model.

Chapter 14 shows an example of how to create data-driven selectors using named clickSelects/showSelects in an interactive visualization of a peak detection model.

Chapter 15 explains how to create an interactive visualization of the Newton root-finding algorithm.

Chapter 16 explains how to create an interactive visualization of an optimal changepoint detection model.

Chapter 17 explains how to create an interactive visualization of the k-means clustering algorithm.

Chapter 18 explains how to create an interactive visualization of the gradient descent algorithm for learning neural network weight matrices.

Appendix

The appendix contains detailed explanations of several R code idioms that are used throughout this manual.