Animating Makie plots
There are many ways to animate Makie
plots; here, we will explore one of them. The general idea is similar to the one presented for Plots
; we need to modify a plot to create the animation frames iteratively. To achieve that, Makie
offers the record
function, which can use Figure
, FigureAxisPlot
, or Scene
to animate an iterator that returns the values changing through time and a function that uses these values to modify the plot. This function is the first argument to record
, so we can use the do
syntax to create it. Inside that function, you can rely on the Observables
mechanism, which we discussed in Chapter 3, Getting Interactive Plots with Julia. The advantage of this is that Makie
updates only parts of the plot that have changed in each frame, rather than rendering an entirely new figure, which is what Plots
does. Let's explore this by creating a GIF animation of the rotating point using GLMakie
and Pluto
:
- Create a new Pluto notebook.
- Execute...