gpt4 book ai didi

html - 在 knitr 中加快 fig.show 间隔

转载 作者:太空狗 更新时间:2023-10-29 15:08:09 24 4
gpt4 key购买 nike

我正在使用 knitr 从 rmarkdown 文件创建一个 html 文档,并插入一个动画代码块,如下所示:

```{r,fig.show='animate'}
for(i in 1:10) plot(rnorm(10))
```

动画创建得很好,但是,我还没有找到加速动画的方法。例如,动画包有 saveGIF()interval 参数,它允许加速或减慢 gif。欢迎任何建议!

最佳答案

block 选项 interval 允许您设置帧持续时间,而 aniopts 选项允许您传入一个字符串,其中包含直接传递给 LaTeX 包的选项 动画。 (两者都记录在 the knitr package's options documentation 的“动画”部分)

因此,例如,要将动画速度提高 5 倍并为其提供控件但不循环,请执行以下操作:

```{r, fig.show='animate', interval=0.2, aniopts="controls"}
for(i in 1:10) plot(rnorm(10))
```

关于html - 在 knitr 中加快 fig.show 间隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28078104/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com