animation time with gganimate

Hi Community

I want make a plot animate. I need that the points appear and desappear, but only make that the movements of points.

df <- tibble(
x = rnorm(100)
, y = rnorm(100)
, size = rep(c(2, 3, 4, 5), 25)
, cl = sample(c("a", "b"), 100, T)
, time = rep(1:10, 10) #|> lubridate::year()
p2 <-
df |>
ggplot() +
aes(x, y, size = size, color = cl) +
geom_point() +
scale_size(range = c(5, 12)) +
transition_reveal(time) +
#transition_manual(time) +
shadow_mark(past = F, future = T)
animate(p2, renderer = gifski_renderer("sa.gif"))


Cross posted here:

1 Like

Yes, Im posted in both communty, for better help.

Please be aware of our cross-posting policy

1 Like

@andresrcs, tnks. I had not seen this community policy. Thanks for sharing and clarifying. I agree, it was a mistake for not knowing this, it will not be repeated.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.