首页 > 解决方案 > 无法调用 gganimate 函数

问题描述

gganimate从 CRAN 安装软件包并运行提供的示例代码:

library(ggplot2)
library(gganimate)
library(gapminder)

ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, colour = country)) +
  geom_point(alpha = 0.7, show.legend = FALSE) +
  scale_colour_manual(values = country_colors) +
  scale_size(range = c(2, 12)) +
  scale_x_log10() +
  facet_wrap(~continent) +
  # Here comes the gganimate specific bits
  labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
  transition_time(year) +
  ease_aes('linear')

但出现以下错误:

UseMethod(“conditionCall”)中的错误:没有适用于“conditionCall”的方法应用于“NULL”类的对象

我已经安装了magick,所以可以弄清楚这里发生了什么。任何建议将不胜感激。

标签: rggplot2gganimate

解决方案


推荐阅读