# Makie control heatmaps of volumeslices

**URL:** https://discourse.julialang.org/t/makie-control-heatmaps-of-volumeslices/121696
**Category:** Visualization
**Tags:** makie
**Created:** [October 24, 2024, 12:50pm UTC](https://discourse.julialang.org/t/makie-control-heatmaps-of-volumeslices/121696 "2024-10-24T12:50:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![trasor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/trasor/32/213340_2.png) [@trasor](https://discourse.julialang.org/u/trasor)
#### Post date: [October 24, 2024, 12:50pm UTC](https://discourse.julialang.org/t/makie-control-heatmaps-of-volumeslices/121696/1 "2024-10-24T12:50:08Z")

</div>

Hello everyone.

I try to use Makie to plot heatmap slices though a volume with their volumeslices functionality: [volumeslices | Makie](https://docs.makie.org/stable/reference/plots/volumeslices#Makie.volumeslices-reference-plots-volumeslices)

However, i am unable to control the positions or the numbers of the slices:

```
using CairoMakie
nx = 25
ny = 26
nz = 27
dim = (nx,ny,nz)

imageXY = rand(nx, ny) 
imageXZ = rand(nx, nz) 
imageYZ = rand(ny, nz)  

V = zeros(dim)
V[:,:,13] .= imageXY
V[:,13,:] .= imageXZ
V[13,:,:] .= imageYZ

fig = Figure()
ax = LScene(fig[1, 1])

plt = volumeslices!(ax, 1:nx, 1:ny, 1:nz, V,
                    colorrange=(0,1))
fig

```

Here the images are locked to x,y,z = 0, but in order so the non-zero planes, i need to move them to the index x,y,x = 13 in this example.  
I cannot follow their documentation, cause they implemented interactive sliders (which i dont want).  
Does anyone know how to get control about the positions of the heatmaps?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)
#### Post date: [October 24, 2024, 1:07pm UTC](https://discourse.julialang.org/t/makie-control-heatmaps-of-volumeslices/121696/2 "2024-10-24T13:07:24Z")

</div>

You’re just missing a few lines to update the positions of the slices before displaying your plot:

```julia
plt[:update_yz][](13)
plt[:update_xz][](13)
plt[:update_xy][](13)

```

In the Makie documentation, similar lines appear in the body of the slider update functions:

```julia
on(sl_yz.value) do v; plt[:update_yz][](v) end
on(sl_xz.value) do v; plt[:update_xz][](v) end
on(sl_xy.value) do v; plt[:update_xy][](v) end

```

but in your case, `v` is fixed and does not come from a slider value.

> **Complete example**
>
> ```julia
> using CairoMakie
> using ElectronDisplay
> 
> nx = 25
> ny = 26
> nz = 27
> dim = (nx,ny,nz)
> 
> imageXY = rand(nx, ny)
> imageXZ = rand(nx, nz)
> imageYZ = rand(ny, nz)
> 
> V = zeros(dim)
> V[:,:,13] .= imageXY
> V[:,13,:] .= imageXZ
> V[13,:,:] .= imageYZ
> 
> fig = Figure()
> ax = LScene(fig[1, 1])
> 
> plt = volumeslices!(ax, 1:nx, 1:ny, 1:nz, V,
> colorrange=(0,1))
> 
> plt[:update_yz][](13)
> plt[:update_xz][](13)
> plt[:update_xy][](13)
> 
> fig
> 
> ```

---

<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: [October 25, 2024, 6:43am UTC](https://discourse.julialang.org/t/makie-control-heatmaps-of-volumeslices/121696/3 "2024-10-25T06:43:36Z")

</div>

That’s admittedly a weird and otherwise undocumented interface. Probably there should be an attribute like `index` that takes a tuple of three integers I think.
