r - 在 R gganimate 中做动画时如何保留以前的数据层?
问题描述
我正在使用 ggplot 和 gganimate 做动画。在之前的 gganimate 版本中有一个“累积”选项,似乎新版本不支持这个。
这是代码:
library(ggplot2)
library(gganimate)
x = data.frame(y = c(2000, 2001), x=c(1,2), z=c(3,4))
ggplot(x, aes(x,z))+geom_point() + transition_time(y)
它有效,但我想将第一个数据点保留在散点图上。
我试图转换数据,但它没有帮助:
x1 = data.frame(y = c(2000, 2001, 2001), x=c(1,2,1), z=c(3,4,3))
ggplot(x1, aes(x,z))+geom_point() + transition_time(y)
解决方案
推荐阅读
- java - executeBatch() 是否也清除命令列表?
- c# - 添加方法后有关静态局部函数的错误
- c# - 使用 c# Web 浏览器(iframe 中的文本框和按钮)以编程方式登录 Kingdoms.com
- r - 逐行比较给定标准的值,每行只写一个数字(超过/不超过标准)
- javascript - 有没有办法在 React 中使用我的 JS 文件?导出或脚本标签等?
- java - 将xml映射器添加到java代码中myBatis的配置中,路径与接口一不同
- angularjs - UI Bootstrap 弹出框没有事件监听器
- python - 解释 keras 功能中的 SGD
- java - 跳过 RegEx 分组
- wordpress - 如何将 Joomla K2 迁移到 Wordpress