use*_*588 8 multithreading r ggplot2 rstudio gganimate
I am currently creating a gif which contains large data. I want it in high resolution.
On my old PC it took hours to render and simply wasn't worth it.
My new PC has a very strong intel i9-9900k core processor which has sped it up to about 30 minutes but R only uses 1 core by default... I have 8 available and it would be great if I could just use them to get the rendering done in under 5 minutes. I will be needing to run this multiple times a week so it would be amazing to be able to use all 8 cores.
Is there anyway to take advantage of this? I know you can use multi-threading in some R code but I can't figure it out with ggplot2/gganimate.
我也有一个强大的图形卡,如果可以以任何方式使用它可以加快速度。
或者,如果有其他方法可以加快它的速度,即使这意味着更改软件包甚至是编程语言也将是不错的选择!
正如 Roman 在评论中指出的那样,有一个拉取请求可以促进动画 ggplot 的并行处理。
这是一个带有基准的示例,来自GitHub 评论
library(gganimate)
anim <- ggplot(mtcars, aes(mpg, disp)) +
transition_states(gear, transition_length = 2, state_length = 1) +
enter_fade() +
exit_fade()
future::plan("sequential") ## default
t0 <- system.time(animate(anim))
print(t0)
future::plan("multiprocess", workers = 4L)
t1 <- system.time(animate(anim))
print(t1)
print(t0 / t1)
## user system elapsed
## 2.2802385 0.9121339 2.5819751
Run Code Online (Sandbox Code Playgroud)
拉取请求尚未合并,但如果您现在需要这个,您可以安装该特定的分叉devtools::install_github()
这比之前指出的要容易得多
归档时间: |
|
查看次数: |
184 次 |
最近记录: |