GGAnimate软件包未加载gif

时间:2019-11-22 06:24:25

标签: r gganimate

我正在直接使用gganimate.com官方网站上的代码

library(ggplot2)
library(gganimate)

ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  # Here comes the gganimate code
  transition_states(
    gear,
    transition_length = 2,
    state_length = 1
  ) +
  enter_fade() + 
  exit_shrink() +
  ease_aes('sine-in-out')

而不是输出gif动画,而是不断获取保存在我的工作目录中的单个png文件。我只想要gif /动画。我看不到必须将这些个人png组合在一起的额外步骤……有人可以建议吗?谢谢。

2 个答案:

答案 0 :(得分:1)

我的Tidyverse程序包(包含ggplot2,从属库)为1.2.1,并将其更新到最新版本(1.3.0)之后,现在可以在Viewer中正确显示动画了。

我得出结论,Tidyverse 1.2.1和gganimate 1.0.4可能存在一些错误,阻止了动画的开始。

答案 1 :(得分:1)

我遇到了同样的问题,一旦安装了Gifski软件包,一切都会变得非常完美。