# Displaying figure while recording animation using Makie.record

**URL:** <https://discourse.julialang.org/t/displaying-figure-while-recording-animation-using-makie-record/110269>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [February 15, 2024, 6:21pm UTC](https://discourse.julialang.org/t/displaying-figure-while-recording-animation-using-makie-record/110269 "2024-02-15T18:21:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [February 15, 2024, 6:21pm UTC](https://discourse.julialang.org/t/displaying-figure-while-recording-animation-using-makie-record/110269/1 "2024-02-15T18:21:04Z")

</div>

I am able to record an animation of a figure in Makie using `record`. I can check if the figure is correctly updated in the animation by playing the movie file after the recording finishes. However, animation creation usually takes time because it requires the whole iteration. So, I would like to monitor the evolution of the figure while the animation is being generated.

I thought this can be easily done by putting `display(fig)` in the `record` loop, but it didn’t work. Here is an example:

```julia
using CairoMakie

xs = range(0, 2π, 100)
fig = Figure()
record(fig, "test_record.mp4", 0:5) do n
    empty!(fig)
    fig[1,1] = Axis(fig, limits=(0,2π,-1,1))
    lines!(xs, sin.(n .* xs))

    # display(fig)
    #
    # The above line
    # - either crashes the integrated REPL when runs in VScode,
    # - or does not update the figure when runs in terminal.
end

```

How can I display the evolution of a figure while the evolution is being recorded?

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [February 15, 2024, 6:47pm UTC](https://discourse.julialang.org/t/displaying-figure-while-recording-animation-using-makie-record/110269/2 "2024-02-15T18:47:00Z")

</div>

Is using GLMakie an option? There, you can put `disolay(fig)` before the `record` block and it will show the updated figure in an extra window (make sure to call `Makie.inline!(false)` to not use the plot plane.)

Also check out the Makie tutorial on animations. There are efficient ways to update plotting data using `Observables`. With that, making videos is often very fast (in my cases easily 10 to 100 times faster than naive re plotting.)

[https://docs.makie.org/stable/explanations/animation/](https://docs.makie.org/stable/explanations/animation/)
