Skip to content

Further integration with knitr? #134

@yihui

Description

@yihui

Finally I have a chance to play with this package and think about better integration with knitr: https://twitter.com/thomasp85/status/1021462758007672834 :)

I don't know what chunk options you need from knitr (it appears that gganimate already works amazingly well in R Markdown), but currently I wonder if the three chunk options fig.width, fig.height, and dev can be supported (you may also need to use dpi).

```{r, fig.width=4, fig.height=10}
library(ggplot2)
library(gganimate)

ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  # Here comes the gganimate code
  transition_states(
    gear,
    transition_length = 2,
    state_length = 1
  ) +
  enter_fade() + 
  exit_shrink() +
  ease_aes('sine-in-out')
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions