This code shows how to animate rotifers trajectories extracted with BEMOVI via gganimate

Exported from Notepad++
# Install needed packages install.packages(c("gganimate","glue","rlang","stringi","gifski","viridis")) # Load gganimate and viridis, ggplot2 will be loaded automatically library(gganimate) library(ggplot2) library(viridis) # Import the Brachionus calyciflorus dataset BRA = read.delim("C:/.../BRA.txt") # Build the ggplot base graph anim_1 = ggplot(BRA, aes(X, Y)) # Facet grid to show sexes, colorize according to direction, add styling anim_2 = anim_1 + geom_point(aes(size=abs_angle, colour=factor(round(abs_angle)))) + scale_size(range = c(2, 5)) + facet_grid(.~SEX) + scale_color_viridis(discrete=TRUE) + theme( plot.title = element_text(color="white",hjust=0, vjust=1, size=rel(2)), plot.background = element_rect(fill="gray20"), panel.background = element_rect(fill="gray20"), panel.border = element_rect(fill=NA,color="gray50", size=0.5, linetype="solid"), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.title=element_blank(), axis.text=element_blank(), strip.text.x = element_text( size = 12, face = "bold"), legend.position = "none") # Animate the frames of the graph anim_3=anim_2 + transition_time(frame) + labs(title = "Frame: {frame_time}") + shadow_wake(wake_length = 0.125, alpha = 0.4) # Lastly, get the animation (takes a while...) animate(anim_3, fps = 20, width = 800, height = 420)