【发布时间】:2018-08-15 17:45:02
【问题描述】:
我将使用 gapminder 数据作为示例。假设我创建了这个动画:
library(gapminder)
library(ggplot2)
theme_set(theme_bw())
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color =
continent, frame = year)) +
geom_point() +
scale_x_log10()
library(gganimate)
gganimate(p)
gganimate(p, "output.gif")
现在,我想访问构成 gif 的各个图像(帧)。有没有办法在 gganimate 中做到这一点,还是我需要使用动画包?
【问题讨论】:
-
可能有帮助:来自小插图 (github.com/dgrtwo/gganimate):“当在 knitr 中运行时(并结合 knitr 的 fig.show = "animate" 块选项),它会按顺序显示每个图形让 knitr 创建动画。”