animated and interactive web graphics
R JavaScript HTML Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
R throw informative error Dec 10, 2016

animint - an R package for animated interactive web graphics

Build Status Coverage Status wercker status

Animint makes it possible to design multi-layer, multi-plot, interactive, and possibly animated data visualizations using just a few lines of R code. Animint adds clickSelects and showSelected aesthetics to ggplot2, and renders using D3. For example, this multi-layer facetted interactive animation of WorldBank data was defined using only about 60 lines of R code.

WorldBank viz screenshot


if (!require(devtools)) install.packages("devtools")
devtools::install_github("tdhock/animint", upgrade_dependencies=FALSE)

NOTE: animint now works with standard ggplot2 >= 2.0 thanks to Faizan and Kevin! If you want to use the animint chunk_vars option then you will need to install faizan-khan-iit/ggplot2@validate-params until the ggplot2 developers resolve the issue.

Learning animint through examples

The best way to learn animint is by reading the Animint Designer Manual. Some other good introductions are Carson Sievert's Interactive animations of PITCHf/x and Susan VanderPlas' animint tutorial. In addition, animint includes many example data visualizations in our extensive set of test cases.

Frequently asked questions (FAQ)

Contribute to animint!

Write tests to increase code coverage

The easiest way to contribute to animint is by writing a new test that would increase the code coverage. First check the coveralls status page and find a part of the code which is not tested. Then fork animint and commit a new test that increases the coverage, and send us a Pull Request. It may be useful to read about our testing framework.

Learn about the design and theory of animint

Before adding features to animint, you should first read about its design. There are two main components, which have separate wiki pages that explain their details:

  • The compiler is written in R code.
  • The renderer is written in JavaScript code.

It would also be useful to read some theory in the academic paper describing Animint. It explains:

  • the purpose of animint: make it easy to design data visualizations which can be both animated and interactive.

  • the clickSelects and showSelected keywords which permit interactive linked plots.

  • the advantages and disadvantages of animint compared to other interactive data viz libraries.

It may also be useful to read our short and long tables of related work.

TODO list of features to implement

We keep a TODO list at top of the NEWS file. Feel free to implement one and send us a PR. They are categorized as follows:

  • BUG: things which used to work but have stopped working. Tests should be added to prevent these. For example at one point in 2013, animint rendered the correct number of legend entries for the WorldBank viz, but in the beginning of 2014 animint rendered too many legend entries.
  • GGPLOT: things which ggplot2 supports but animint does not yet support. For example facets, coord_equal.
  • DSL: changes to the animint domain-specific language (DSL) which would allow interactive/animated features. These involve changes to how we define the ggplots, and how the compiler works. For example custom alpha/color/etc for selected geoms, using selected.alpha/selected.color/etc aesthetics.
  • EXAMPLE: examples to show off animint features, which should affect neither the compiler nor renderer.
  • RENDER: changes to the JavaScript rendering code which would result in better interactive plots, without having to change the definition of the ggplots. For example rendering a selection widget for every selection variable.
  • OUTPUT: different output formats for viewing/sharing an interactive animation.
  • OPTIMIZATION: things which are currently supported, but with an implementation that could be improved in terms of render/compile speed, disk usage, memory, etc. Typically these optimizations are not really noticed for small data sets, but make it easier to visualize large data sets. For example, can we gzip the TSV plot data files to reduce disk space and download times?