Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for (non-facet) grid? #507

Open
katrinabrock opened this issue Dec 23, 2024 · 0 comments
Open

Support for (non-facet) grid? #507

katrinabrock opened this issue Dec 23, 2024 · 0 comments

Comments

@katrinabrock
Copy link

Hello,
Thanks for this package!
I'm trying to make an animation that consists of multiple plots and I'm wondering if it's supported.

I found this doc, but it looks very outdated since it references magick rather than gifski. https://github.com/thomasp85/gganimate/wiki/Animation-Composition

I've tried using the girdExtra::arrangeGrob but it doesn't seem to work.

library(gridExtra)
library(ggpubr)
library(ggplot2)

# transition, then arrange
p1 <- ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  transition_states(
    gear
  )
p2 <- ggplot(mtcars, aes(qsec, mpg)) + 
  geom_line() + 
  transition_states(
    gear
  )
p_full <- arrangeGrob(p1, p2)

# arrange, then transition
p1 <- ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() 
p2 <- ggplot(mtcars, aes(qsec, mpg)) + 
  geom_line()
p_full <- arrangeGrob(p1, p2) + transition_states(gear)
str(p_full) # NULL

Trying to arrange together gganim objects, I get

Error in UseMethod("ggplot_gtable") : 
  no applicable method for 'ggplot_gtable' applied to an object of class "gganim_built"

Trying to add transition_states() to gtable object returns NULL

Is this functionality supported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant