我正在使用 ggplot 和 gganimate 做动画。在之前的 gganimate 版本中有一个“累积”选项,似乎新版本不支持这个。
这是代码:
library(ggplot2)
library(gganimate)
x = data.frame(y = c(2000, 2001), x=c(1,2), z=c(3,4))
ggplot(x, aes(x,z))+geom_point() + transition_time(y)
它有效,但我想将第一个数据点保留在散点图上。
我试图转换数据,但它没有帮助:
x1 = data.frame(y = c(2000, 2001, 2001), x=c(1,2,1), z=c(3,4,3))
ggplot(x1, aes(x,z))+geom_point() + transition_time(y)
