- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个动画来向学生展示如何用动画表示数据。
运行下面的代码
library(ggplot)
library(gganimate)
library(carData)
anim <- ggplot(mtcars, aes(mpg, disp)) +
transition_states(gear, transition_length = 2, state_length = 1) +
enter_fade() +
exit_fade()
animate(anim)
[1] "./gganim_plot0001.png" "./gganim_plot0002.png" "./gganim_plot0003.png"
[4] "./gganim_plot0004.png" "./gganim_plot0005.png" "./gganim_plot0006.png"
[7] "./gganim_plot0007.png" "./gganim_plot0008.png" "./gganim_plot0009.png"
[10] "./gganim_plot0010.png" "./gganim_plot0011.png" "./gganim_plot0012.png"...
attr(,"frame_vars")
frame nframes progress transitioning previous_state closest_state
1 1 100 0.01 FALSE 3 3
2 2 100 0.02 FALSE 3 3
3 3 100 0.03 FALSE 3 3
next_state
1 3
2 3
3 3
4 3
5 3
6 3
7 3
8 3
9 3
10 3
11 3
12 3
frame_source
1 C:\\Users\\rosar\\AppData\\Local\\Temp\\RtmpIR4dH3\\3b84232b4eef/gganim_plot0001.png
2 C:\\Users\\rosar\\AppData\\Local\\Temp\\RtmpIR4dH3\\3b84232b4eef/gganim_plot0002.png
3 C:\\Users\\rosar\\AppData\\Local\\Temp\\RtmpIR4dH3\\3b84232b4eef/gganim_plot0003.png
最佳答案
确保您拥有将图像组合成视频所需的软件包之一。我建议你使用 gifski:
install.packages('gifski')
install.packages('png')
关于ggplot2 - gganimate 返回 .png 文件,但没有动画对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58991580/
有没有办法将使用 ffmmeg_renderer 或 av_renderer 制作的电影保存为单独的文件?我总是将主题作为数据嵌入到 html 文件中。 最佳答案 使用来自@Roman 的示例,我将使
我有以下数据框: # Seed RNG set.seed(33550336) # Create data frame df 将显示一个整数。如果frame_time是一个常规变量,那么使用bquot
几天来我一直在努力解决这个问题,但我不明白我错过了什么。 gganimate 似乎没有在帧之间添加任何过渡。 我正在使用 Tour de France dataset from the tidytue
是否可以在一个动画循环后停止? 动画应执行到去年 2021 年,然后停止显示所有条形图! 这是一个使用 gganimate 的条形动画示例: library(tidyverse) library(gg
我想将我的数据的另一列值插入gganimate动画标题中。 例如,这里的状态级别变量是x,我想添加到标题变量y: df 1 1 a 2 2 a 3 3 b
我有以下生成静态图表的 R 脚本 library(ggplot2) library(dplyr) library(tidyr) library(stringr) library(gta
是否可以在 gganimate 循环之间添加暂停?我知道我们可以使用 interval 设置帧之间的间隔,但是有没有办法在循环回第一帧之前在最后一帧暂停? 将最终帧的多个副本插入到数据中的最佳方法是吗
我正在尝试使用 gganimate 绘制一段时间内 NHL 前 3 名得分手的图。目前,我有一个柱形图,其中 x 轴显示球员姓名,y 轴显示每个球员的进球数。这是我所拥有的静态版本: library(
我有一个如下所示的数据框: head(newnolarank) lon lat week b 1 -90.06445 29.97121 1 9 2 -90.06704 29.9
遵循源代码 Here 。我正在尝试用我的数据复制它。我有一个时间序列数据,我在 y 轴上绘制事件和非事件数字。这是我的示例数据结构: df <- tibble::tribble( ~Date, ~
我已经解析了电子游戏《反恐精英》中手榴弹 throw 的一些数据。下面的示例数据显示我有关于手榴弹从哪里 throw 、手榴弹爆炸的位置以及何时 throw 手榴弹的位置。 df % # Add
我正在尝试使用 gganimate 绘制一段时间内 NHL 前 3 名得分手的图。目前,我有一个柱形图,其中 x 轴显示球员姓名,y 轴显示每个球员的进球数。这是我所拥有的静态版本: library(
我第一次尝试 gganimate 包,但在处理缺失值 (NA) 时遇到了问题。如果我的问题很微不足道,但我找不到任何解决方案,我深表歉意。 这是我正在尝试做的事情的可重现示例: # Load libr
我正在使用 gganimate。假设我有这个 MWE: library(ggplot2) library(gganimate) ggplot(airquality, aes(Day, Temp)) +
使用 gganimate 从 ggplot 制作动画时,我需要设置较低的速度以允许人们读取数据。 阅读文档(很难找到选项)似乎“nframes”是正确的设置。但我不能减慢动画或设置持续时间。两种方法中
以下两行代码,取自 script ,做我认为他们应该做的;也就是使用之前生成的ggplot文件——gganim——在Rstudio的查看器(第一行)中创建一个动画,并将最后一个动画保存到我mac上的g
我正在尝试显示随着时间的推移构建的直方图。它将从 1952 年的数据开始,然后每年更新直方图,并不断增长。 路径似乎是 gganimate,我认为使用 transition_reveal随着时间的推移
我在设置动画时无法设置绘图的宽度。 因此,如果我使用库 gapminder 制作静态图,代码如下: library(ggplot2) library(gganimate) theme_set(them
我想将绘图标签(标题、副标题)对齐到图像的左侧,而不是绘图区域的左侧,以获得 gganimate 动画。 这可以通过转换为 gtable 然后修改布局来使用静态图表。动画需要一种不同的方法,因为 gg
试图创建一个具有简单特征的动画,本质上是一个区域分布图形式的空间变量的时间序列。 问题是多边形在动画播放时遍布整个情节。 这是一个可重现的示例,部分摘自 https://www.blog.cultur
我是一名优秀的程序员,十分优秀!