2

I'm getting an animation with empty canvas when using ggridges.

library(ggplot2)
library(ggridges)
library(gganimate)

df = data.frame(id = rep(1:5, each = 10),
                t = rep(1:10, 5),
                y = runif(50))

p1 = ggplot(df,
            aes(x = t,
                y = id,
                group = id,
                height = y)) +
  ggridges::geom_density_ridges(stat = "identity",
                                fill = NA) +
  gganimate::transition_reveal(t)

gganimate::animate(p1, nframes = 50, fps = 10)

A static plot, not an animation, displays properly.

mattek
  • 903
  • 1
  • 6
  • 18

0 Answers0