Dynamical label text using @lift (makie)

You do need display(fig) if you are working on a Jupyter Notebook, for example.

But, even when using a Jupyter notebook, executing the following code inside a single cell works for me.

using GLMakie

time = Observable(0.0)
dt = 0.1

text = @lift("time = $($time)")

fig = Figure()
ax = Axis(fig[1, 1])
Label(fig[1, 1], text)

step!() = time[] += dt

display(fig)

for i in 1:100
    step!()
    sleep(0.01)
end

What are you using to execute your code?

1 Like