我正在尝试使用gganimate涵盖 90 年的数据集创建一个 GIF,即我想要一个 GIF 运行 90 个州/年。但是,似乎gganimate只能处理不到 50 个州。
所以这里有一个例子:
library(tidyverse)
# devtools::install_github('thomasp85/gganimate')
library(gganimate)
df = expand.grid( x = 1,
y = c(2,3),
year = 1670:1760) %>% mutate( z = 0.03* year,
u = .2 * year)
这一切都可以正常工作 49 年:
ggplot(data=df %>% filter(., year %in% 1670:1719) , aes()) +
geom_point( aes(x = x, y = y, fill = z, size = u), shape = 21 ) +
labs( title = 'Year: {closest_state}') +
enter_appear() +
transition_states(year, transition_length = 1, state_length = 2)

然而,当我包括 50 年(或更多)年时,它变得很奇怪:
ggplot(data=df %>% filter(., year %in% 1670:1720) , aes()) +
geom_point( aes(x = x, y = y, fill = z, size = u), shape = 21 ) +
labs( title = 'Year: {closest_state}') +
enter_appear() +
transition_states(year, transition_length = 1, state_length = 2)

如何为所有 90 年创建一个 GIF?欢迎任何想法!
我还是新手gganimate,我使用transition_states不正确吗?
