My question is how can I utilize multiple cores of my iMac in order to make gganimate go faster. There is another question (and more linked to below) that asks this same thing—my question is about an answer to this question: Speed Up gganimate Rendering.
In that answer, Roman and mhovd point out an example from this GitHub comment (see also this GitHub post):
library(gganimate)
library(future)
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)
I have tried this, but get times that are very close to each other:
user system elapsed
1.0041475 0.9775679 0.9995509
Is there something else I need to do beyond this code? Based on the aforementioned StackOverflow answer or from the GitHub pages, I can't tell if this code is supposed to work as is or if there was other modifications behind the scene that were done.
If it helps, I am using an iMac with an 8-Core Intel processor. I am also running this in R because RStudio said something about how it doesn't support multi-core.
Note also that my question also broadly relates to these three past questions:
- Using multiple CPU cores in R+ggplot2+gganimate
- How can I make R take advantage of dual GPU?
- How to manage parallel processing with animated ggplot2-plot?