Created
October 11, 2018 19:40
-
-
Save thomasp85/14ed997191f7c6d363517a4dd89f090b to your computer and use it in GitHub Desktop.
An example of embedding a gganimate animation in a pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "PDF Animation Test" | |
output: pdf_document | |
header-includes: | |
- \usepackage{animate} | |
--- | |
`gganimate` now supports animations inside PDF documents. This feature is only | |
viewable with Acrobat Reader, however. Remember to include | |
`\usepackage{animate}` in the preamble and set `fig.show='animate'` in the chunk | |
options. Further, the framerate is governed by `interval`rather than any | |
`gganimate` settings: | |
```{r, fig.show='animate', interval=1/10} | |
library(gganimate) | |
ggplot(airquality, aes(Day, Temp, group = Month)) + | |
geom_line() + | |
transition_reveal(Month, Day) | |
``` |
You might also want to use transition_reveal(Month)
in line 18 instead of transition_revel(Month, Day)
as indicated thomasp85/gganimate#270
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to get and html_document output with controls? Similar as done in the PDF document.