【问题标题】:gganimate attempt fails with error in adding element to ggplotgganimate 尝试失败,将元素添加到 ggplot 时出错
【发布时间】:2020-04-02 20:14:04
【问题描述】:

我正在尝试为地图制作动画,但未能执行 transition_states 函数。

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

library(gganimate)
#> Loading required package: ggplot2

# We'll start with a static plot
p <- ggplot(iris, aes(x = Petal.Width, y = Petal.Length)) + 
    geom_point()

plot(p)

anim <- p + 
    transition_states(Species,
                      transition_length = 2,
                      state_length = 1)

Error: Don't know how to add transition_states(Species, transition_length = 2, state_length = 1) to a plot

不幸的是,此错误含糊不清,此处(或其他地方)几乎没有适用的问题。我渴望任何关于在哪里寻找的建议。

【问题讨论】:

  • 代码按预期工作。尝试重置会话并再次运行?
  • 有趣。当我在干净的工作会话中运行代码时,它可以工作。必须加载另一个干扰 gganimate 的包。谢谢第二个意见。当我了解更多时,我会更新。

标签: r ggplot2 gganimate


【解决方案1】:

安装 ggtern 后,gganimate 将无法正常运行。一旦我删除了 ggtern,gganimate 就按预期工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多