animint - an R package for animated interactive web graphics
Interactive animations using ggplot2's grammar of graphics implementation combined with clickSelects and showSelected aesthetics.
if (!require(devtools)) install.packages("devtools") devtools::install_github(c("tdhock/ggplot2", "tdhock/animint"), build_vignettes=FALSE) library(animint) example(animint)
Learning animint through examples
The best way to learn animint is through examples. A couple of good introductions are Carson Sievert's Interactive animations of PITCHf/x and Susan VanderPlas' animint tutorial. In addition, there is an examples web site, examples distributed with animint, as well as more complex 'big data' examples in the tdhock/animint-examples repo.
Frequently asked questions (FAQ)
Can I do brushing in Animint? If by "brushing" you mean "multiple selection," then yes the designer can use the selector.types option to declare a multiple selection variable, which means that users will be able to click plot elements to add/remove items from the multiple selection set. For example see the WorldBank-facets viz and source code.
Can I use animint inside of a Shiny app? Yes.
Can I use animint inside of knitr? Yes, but use
structure(viz, class="animint")rather than
Carson Sievert, Susan VanderPlas and Toby Dylan Hocking wrote an academic paper describing Animint. If you would like to contribute code to animint, please read the paper first to get an overview of the package. 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.
Contribute to animint!
Before contributing to animint, you should first read about its design. There are two main components, which have separate wiki pages that explain their details:
We keep a TODO list at top of the NEWS file. 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.
- 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?
We are open to pull requests. If your changes pass our tests, then we are happy to merge them.