using Plots # Simple dataset of 50 random numbers y = rand(50) # Use the @animate macro in front of a loop to create each frame of your animation anim = @animate for i in 1:50 # At each iteration we will plot a new subset of the data # I set the xlimits and ylimits so the x/y axes don't autofit as the data grows plot(y[1:i], xlims=(1,50), ylims=(0,1)) end # Save the animation as a gif and display it gif(anim) gif(anim, "new_animation.gif", fps=12) @gif for i in 1:50 plot(y[1:i], xlims=(1,50), ylims=(0,1)) end