I am trying to arrange to gganimate plots side by side. All the code executes, but when I call the resultant gif I get the following error:
Error in magick_image_info(image) :
rsession.exe: Invalid geometry argument
Searching for that error, I get no results on google.
I can't pull together a full reproducible example as the df's underlying the two animations are large. Below is the code that I use to try and arrange the two animations together. Note that both the individual animations run fine on their own.
#load libraries
library('ggplot')
library('gganimate')
library('magick')
#create the first animation
a <- ggplot(df, aes(...)) +
... #rest of ggplot call
transition_time(year)
#create the second animation
a2 <- ggplot(df, aes(...)) +
... #rest of ggplot call
transition_reveal(year)
#Render the animations
#The value of of length(unique(df$year)) is the same across both calls
anim1 <- animate(a, nframes = length(unique(df$year)), fps = 3)
anim2 <- animate(a2, nframes = length(unique(df$year)), fps = 3)
#Convert the gifs to magick objects
anim1_magic <- image_read(anim1)
anim2_magic <- image_read(anim2)
#Combine the magick objects into a single gif
#This code completes without an error
anim1_2 <- image_append(c(anim1_magic[1], anim2_magic[1]), stack = F)
for(i in 2:length(unique(berk_records$year)) - 12) {
combined <- image_append(c(anim1_magic[i], anim2_magic[i]))
anim1_2 <- c(anim1_2, combined)
}
#display the combined animation
anim1_2
Throws error:
Error in magick_image_info(image) :
rsession.exe: Invalid geometry argument
I can try and dput some data if that would be helpful, but if anyone can see what the issue is here, that would be very much appreciated.