# Animate Makie.volume! doesn't work

**URL:** <https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162>\
**Category:** New to Julia\
**Tags:** plotting\
**Created:** [November 27, 2024, 12:56pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162 "2024-11-27T12:56:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![YoffeG](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yoffeg/32/213772_2.png) [@YoffeG](https://discourse.julialang.org/u/YoffeG)\
**Post date:** [November 27, 2024, 12:56pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162/1 "2024-11-27T12:56:28Z")

</div>

Hey all, assume I have a time-varying 3d volume that I wish to animate and save as an mp4 file, where the volume is simply a color-coded cube, where the color coding is the value of each pixel varying in time. I found no correct syntax or good example to draw inspiration from, except for a futile attempt to make CairoMakie.record work.  
I’d appreciate some aid with this!

Thanks in advance,

Gidi

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [November 27, 2024, 4:51pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162/2 "2024-11-27T16:51:08Z")

</div>

Hi,  
CairoMakie doesn’t support volume rendering.  
You need to use GLMakie.  
Animating that should just work like any other plot type, so without any more information it’s hard to see where you got stuck (besides the backend problem).

---

<div class="post-metadata">

**Author:** ![YoffeG](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yoffeg/32/213772_2.png) [@YoffeG](https://discourse.julialang.org/u/YoffeG)\
**Post date:** [November 27, 2024, 4:58pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162/3 "2024-11-27T16:58:16Z")

</div>

Hey, thanks for the prompt reply!

I figured as much and switched to GLMakie. I cannot add a link here, but should you search Youtube for “Oceananigans Deep convection”, you’ll see the perfect example of how I’d like animate this volume, where the desired x-axis coordinate being some variable.

Many thanks again,

G.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [November 27, 2024, 5:40pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162/4 "2024-11-27T17:40:12Z")

</div>

What have you tried so far? The animation examples in the docs should map to volume, just with different input data

---

<div class="post-metadata">

**Author:** ![keithjlee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keithjlee/32/19469_2.png) [@keithjlee](https://discourse.julialang.org/u/keithjlee)\
**Post date:** [November 27, 2024, 6:31pm UTC](https://discourse.julialang.org/t/animate-makie-volume-doesnt-work/123162/5 "2024-11-27T18:31:16Z")

</div>

GLMakie should be the way to go…here’s a quick example:

```julia
using GLMakie

n = 50
xrange = range(0, 2pi, n)
yrange = range(0, 2pi, n)
zrange = range(0, pi, n)

f = [sin(x) * cos(y) + sqrt(z) for x in xrange, y in yrange, z in zrange]

t = Observable(0.)

ft = @lift(f .* tan($t))

fig = Figure()

ax = Axis3(
    fig[1,1],
)

volume!(xrange, yrange, zrange, ft, colormap = :inferno, colorrange = extrema(f), transparency =true)

fig

record(fig, "volumes.gif", range(0, pi, 120); framerate = 12) do frame
    t[] = frame
end

```

![volumes](https://global.discourse-cdn.com/julialang/original/3X/2/a/2abe3f657d4e30d73ca36d8d63cc7b54ded4eab9.gif)
