r - 使用 ggplot 和 gganimate 制作动画
问题描述
我正在尝试使用 来学习动画情节gganimate
,我想知道是否有人对我遇到的问题有提示。为了使事情变得简单,我通过在 RStudio Cloud 中创建一个新项目,安装ggplot2
、gganimate
和datasauRus
包,并遵循Isaac Faber的这个示例来做到这一点:
library(datasauRus)
library(ggplot2)
library(gganimate)
ggplot(datasaurus_dozen, aes(x=x,y=y)) +
geom_point() +
theme_minimal() +
transition_states(dataset,3,1) +
ease_aes()
这会创建一系列 .PNG 文件,但我看不到动画。有些人似乎建议我可以使用“打印”功能看到它,但这也不起作用。
尽管我遵循了此处给出的建议,但我也无法将其导出为 .GIF 。具体来说,这些magick
包对我不起作用(我收到关于我的图像不是魔法图像对象的相同错误),并且当我尝试以下代码时:
p <- ggplot(datasaurus_dozen, aes(x=x,y=y)) +
geom_point() +
theme_minimal() +
transition_states(dataset,3,1) +
ease_aes()
anim <- animate(p)
anim_save("myfilename.gif",anim)
R告诉我
动画对象没有指定 save_animation 方法。
我一直无法找到告诉我如何指定 save_animation 方法的示例或文档。如果有人对此主题有任何建议,将不胜感激!
解决方案
推荐阅读
- r - 在 R 中将数百个 HDF 文件转换为 .tif
- java - 在 JpaRepository 中使用 postgres 函数时间戳
- android - strings.xml 资源可以有多大?
- python - 四个矩阵的切片数组
- php - 如何在 Symfony REST API 中处理括号字段数组
- python - 如何使用 OOP 使图像移动
- google-apps-script - 为什么在appsscript.json 中存在权限时表单给出必需权限错误?
- android - 我们可以在 Room 中从一个版本迁移到另一个版本时删除记录吗?
- sql - TSQL:根据条件连接表
- javascript - 在我的 Libary/Ethereum 文件夹中找不到文件