【发布时间】:2022-01-27 11:46:35
【问题描述】:
我想制作一个情节动画。我需要点的出现和消失,但只需要点的移动。
set.seed(1)
library(tidyverse)
library(gganimate)
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) +
#enter_fade()
#transition_manual(time) +
shadow_mark(past = F, future = T)
animate(p2, renderer = gifski_renderer("sa.gif"))
【问题讨论】:
-
嗨@Miguel Angel Acosta Chinchilla。你的动画在我的电脑上运行良好。因此,不确定是否完全理解您的要求。干杯。
-
@lovalery,我需要点出现和消失,但在同一位置,而不是像我的代码那样移动。
-
好的。非常感谢您的反馈。所以@Kat 的答案似乎就是你要找的。干杯。