我正在开发一个
gganimate
动画,显示两个指标 x 和 y 之间随时间变化的数据点,并在它们后面尾随一个折线图,显示“你去过的地方”。类似的东西:
library(ggplot2)
library(gganimate)
library(dplyr)
library(gapminder)
gm <- gapminder %>%
filter(continent == 'Oceania') %>%
ggplot(aes(x = gdpPercap, y = lifeExp, group = country, col = country)) +
geom_line() +
geom_point(aes(size = pop), show.legend = FALSE, alpha = 0.7) +
scale_size(range = c(2, 12)) +
scale_x_log10() +
theme_bw() +
transition_reveal(year) +
#labs(title = "Year: {frame_time}") +
NULL
animate(gm, end_pause = 10)
不过,
end_pause
框架有些奇怪。出于某种原因,除了一个点外,所有可见点都消失了,只留下轨迹:
我如何让所有他们留下来,而不仅仅是一个?