Skip to content

Support for (non-facet) grid? #507

@katrinabrock

Description

@katrinabrock

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?

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