# \[Makie.jl\] 3D voxelized visualization of a cubical matrix

**URL:** <https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [March 3, 2022, 2:12pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360 "2022-03-03T14:12:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [March 3, 2022, 2:12pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/1 "2022-03-03T14:12:53Z")

</div>

Dear All,  
Here is another chapter of the struggle to make cool figures with Makie.  
My aim is to generate numerous visualizations of the 3D images that are represented by voxels. While i used the hints from the examples of the volume function, even the simplest solution for a binary (0 and 1) 3D matrix visualization still avoids me.  
Here is the example of the solution i would like to achieve:

 ![example_visual](https://global.discourse-cdn.com/julialang/original/3X/1/0/105fbcb4a70d6753aa714d1f028e698e1822af43.png)  
Now, here is the piece of code i could generate that i expected will produce the image above (but it does not do the trick):

```julia
using GLMakie, ColorSchemes
using GeometryBasics: Rect3f
let
    path="d:\\path\\to\\BCC_100.raw" #this is a .raw binary example for visuazliation
    cd(dirname(path))
    cubesize=trunc(Int64,round(filesize(path)^(1/3)))
    stream = open(path, "r")
    #x, y, z = cubesize
    points3d = Array{UInt8,3}(undef, cubesize, cubesize, cubesize)
    read!(stream, points3d)
    points3d = deepcopy(points3d)
    close(stream)
    for k=1:cubesize, i=1:cubesize, j=1:cubesize
        points3d[i,j,k]=points3d[j,i,k]
    end
    x = y = z = 1:1:cubesize
    vol1 = [ix * iy * iz for ix in x, iy in y, iz in z]
    #points3d = [Point3f(ix, iy, iz) for ix in x, iy in y, iz in z]
    # scale everything to the interval 0,1 (things don't seem to work with colorrange)
    #vol2 = (vol1 .+ 1) ./ 2
    # colormap with transparency in the middle
    cmap = :Hiroshige
    colors = to_colormap(cmap, 101)
    n = length(colors)
    g(x) = x^2
    alphas = [g(x) for x in range(1, cubesize, length = n)]
    cmap_alpha = RGBAf.(colors, alphas)
    # the plot
    fig = Figure(resolution = (1000, 1000))
    #ax1 = Axis3(fig[1, 1], perspectiveness = 0.5, azimuth = 7.19,
     # elevation = 0.57, aspect = (1, 1, 1))
    #ax2 = Axis3(fig[1, 2], perspectiveness = 0.5, azimuth = 6.62,
     # elevation = 0.57, aspect = (1, 1, 1))
    #ax3 = Axis3(fig[2, 1], perspectiveness = 0.5, azimuth = 7.38,
     # elevation = 0.57, aspect = (1, 1, 1))
    ax4 = Axis3(fig[1, 1], perspectiveness = 0.5, azimuth = 6.64,
        elevation = 0.57, aspect = (1, 1, 1))

    #volume!(ax1, x, y, z, vol2; colormap = cmap, transparency = true)
    #contour!(ax2, x, y, z, vol1; colormap = cmap, alpha = 0.05,
    # levels = [collect(-1:0.01:-0.3)..., collect(0.3:0.01:1)...])
    #meshscatter!(ax3, vec(points3d); color = vec(vol1), colormap = cmap_alpha)
    meshscatter!(ax4, vec(points3d); color = vec(vol1), colormap = cmap_alpha,
        marker = Rect3f(Vec3f(-1), Vec3f(2)))
    limits!(ax4, 0, 301, 0, 301, 0, 301)
    #display(fig)
    Makie.save("test.png", fig)
end

```

The example raw binary (path=“d:\path\to\BCC\_100.raw”) for visualization (a 100^3 matrix of 0 and 1 with the structure as on the image below) can be downloaded here:

> **[BCC\_100.raw](https://drive.google.com/file/d/1PmF10AAQOYIJJV78ilqt96TorLJqqeXR/view?usp=sharing)**
>
> Google Drive file.

Many thanks in advance for providing a direction of how i can make some nice visualizations (which i eventually want to extend to non binary multi-colored 3D structures).  
Kirill

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 3, 2022, 2:24pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/2 "2022-03-03T14:24:02Z")

</div>

@KirillGerke if you are processing geospatial objects often, consider the recipes in MeshViz.jl, they really save a lot of manual adjustments if all you need is a simple command to visualize a voxel model:

[https://github.com/JuliaGeometry/MeshViz.jl](https://github.com/JuliaGeometry/MeshViz.jl)

Here is a MWE:

```julia
using Meshes, MeshViz

# choose a backend
import GLMakie as Mke

# domain where the data lives
grid = CartesianGrid(100, 100, 100)

# visualize a random vector of 0s and 1s
viz(grid, color = rand(0:1, 1000000))

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/4/64d48ed8756e36eba05fb776cf8ff76804c981e5.jpeg)

You can pass a vector of Color objects as well instead of simple numbers. So you can use a color with full transparency for the pores and a color without transparency for the matrix.

---

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [March 13, 2022, 10:50am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/3 "2022-03-13T10:50:55Z")

</div>

Thank you, Julio!  
It is indeed a solution. I managed to get something like this:

 ![3dimage](https://global.discourse-cdn.com/julialang/original/3X/7/7/77eec26d69de98d8e9d07ff2ee770141b74ddffd.jpeg)  
Just in case somebody will try to do the same, here is my first try solution in the code:

```julia
using GLMakie, ColorSchemes
using GeometryBasics
using Meshes, MeshViz

#reading in the binary image (the .raw format as it is called)
path="you/path/binary_image.raw"
cd(dirname(path))
cubesize=trunc(Int64,round(filesize(path)^(1/3)))
stream = open(path, "r")
#x, y, z = cubesize
points3d = Array{UInt8,3}(undef, cubesize, cubesize, cubesize)
read!(stream, points3d)
close(stream)

colorvec=Vector{typeof((:red,0.5))}([])
#ok, this part is lame, but i used it to find the correct x-y-z orientation
for k=1:cubesize, i=1:cubesize, j=1:cubesize
    if points3d[i,j,k]==0
        push!(colorvec,(:black,0.01))
    else
        push!(colorvec,(:yellow,0.7))
    end
end

grid = CartesianGrid(cubesize, cubesize, cubesize)
viz(grid, color = colorvec)

```

Now will try to automatically save the figure with the visualization.  
Again, many thanks for fast reply and solution!

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 13, 2022, 11:11am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/4 "2022-03-13T11:11:25Z")

</div>

You are welcome @KirillGerke! Keep in mind that you don’t need to load GeometryBasics.jl if you are relying on Meshes.jl/MeshViz.jl.

Also consider doing `import GLMakie as Mke` instead of loading all symbols into scope. This is to avoid conflict with GeometryBasics.jl primitives used internally in Makie.jl

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 13, 2022, 11:16am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/5 "2022-03-13T11:16:30Z")

</div>

And another tip to make your code look more Julian:

```julia
colorvec = replace(points3d, 0 => (:black,0.01), 1 => (:yellow,0.7)) |> vec

```

You don’t need to loop manually, just use the high-level `replace`

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 13, 2022, 11:23am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/6 "2022-03-13T11:23:43Z")

</div>

One round of cleanup:

```julia
using Meshes, MeshViz

import GLMakie as Mke

path = "/path/to/image.raw"
nvox = round(Int, filesize(path)^(1/3))
buff = zeros(UInt8, nvox, nvox, nvox)

stream = open(path, "r")
read!(stream, buff)
close(stream)

colors = replace(buff, 0 => (:black,0.01), 1 => (:yellow,0.7))

grid = CartesianGrid(nvox, nvox, nvox)
viz(grid, color = vec(colors))

```

---

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [March 13, 2022, 11:25am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/7 "2022-03-13T11:25:02Z")

</div>

This fixed the undefined Rect3 problem i got previously (before adding GeometryBasics).  
Will now update the code as you suggested.  
Thank you again for all advice!

---

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [May 13, 2022, 7:57am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/8 "2022-05-13T07:57:33Z")

</div>

Hello Jullio!  
Thank you again a lot for help in this thread: [[Makie.jl] 3D voxelized visualization of a cubical matrix - #5 by juliohm](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/5)  
However, just today i can’t make the same 3D visualizations - i guess due to some updates. Here are the errors i got:

```julia
ERROR: LoadError: MethodError: Cannot convert an object of type 
  Tuple{Symbol, Float64} to an object of type 
  ColorTypes.Colorant
Closest candidates are:
  convert(::Type{C}, ::C) where C<:ColorTypes.Colorant at C:\Users\M K\.julia\packages\ColorTypes\6m8P7\src\conversions.jl:72
  convert(::Type{C}, ::ColorTypes.Colorant) where C<:ColorTypes.Colorant at C:\Users\M K\.julia\packages\ColorTypes\6m8P7\src\conversions.jl:73
  convert(::Type{C}, ::Number) where C<:ColorTypes.Colorant at C:\Users\M K\.julia\packages\ColorTypes\6m8P7\src\conversions.jl:74

```

The error is for the code in our thread:

```julia
using Meshes, MeshViz

import GLMakie as Mke

path = "/path/to/image.raw"
nvox = round(Int, filesize(path)^(1/3))
buff = zeros(UInt8, nvox, nvox, nvox)

stream = open(path, "r")
read!(stream, buff)
close(stream)

colors = replace(buff, 0 => (:black,0.01), 1 => (:yellow,0.7))

grid = CartesianGrid(nvox, nvox, nvox)
viz(grid, color = vec(colors))

```

Any idea how this error could be fixed?  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 13, 2022, 8:27am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/9 "2022-05-13T08:27:59Z")

</div>

Hi Kirill we recently updated the color handling in the recipes. Can you try passing the vector of colors with the symbols :black etc and a vector of alpha with entries in 0 and 1? For example color=[:black, :yellow] and alpha=[0.5,0.8].

I’ll check in the ColorTypes.jl specs if a color spec (:black,0.5) is officially supported and will add a conversion rule when I’m back on Monday.

---

<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:** [May 13, 2022, 10:02am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/10 "2022-05-13T10:02:37Z")

</div>

that’s a makie conversion rule, which you can use with `Makie.to_color(x)`

---

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [May 13, 2022, 11:02am UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/11 "2022-05-13T11:02:18Z")

</div>

Hello Simon,  
Thank you for a suggestion! Well, i tried to apply it. e.g.,

```julia
fig = viz(grid, color = Mke.to_color(vec(colors))

```

and got something like this:

```julia
ERROR: LoadError: UndefVarError: Rect3 not defined
Stacktrace:
 [1] plot!(plot::MakieCore.Combined{MeshViz.viz, Tuple{CartesianGrid{3, Float64}}})
   @ MeshViz C:\Users\M K\.julia\packages\MeshViz\jcuPy\src\cartesiangrid.jl:38
 [2] plot!(scene::Makie.Scene, P::Type{MakieCore.Combined{MeshViz.viz, Tuple{CartesianGrid{3, Float64}}}}, attributes::MakieCore.Attributes, input::Tuple{Observables.Observable{CartesianGrid{3, Float64}}}, args::Observables.Observable{Tuple{CartesianGrid{3, Float64}}})
   @ Makie C:\Users\M K\.julia\packages\Makie\NL7Xw\src\interfaces.jl:428
 [3] plot!(scene::Makie.Scene, P::Type{MakieCore.Combined{MeshViz.viz}}, attributes::MakieCore.Attributes, args::CartesianGrid{3, Float64}; kw_attributes::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:show_axis,), Tuple{Bool}}})
   @ Makie C:\Users\M K\.julia\packages\Makie\NL7Xw\src\interfaces.jl:339
 [4] plot(P::Type{MakieCore.Combined{MeshViz.viz}}, args::CartesianGrid{3, Float64}; axis::NamedTuple{(), Tuple{}}, figure::NamedTuple{(), Tuple{}}, kw_attributes::Base.Pairs{Symbol, Vector{ColorTypes.RGBA{Float32}}, Tuple{Symbol}, NamedTuple{(:color,), Tuple{Vector{ColorTypes.RGBA{Float32}}}}})
   @ Makie C:\Users\M K\.julia\packages\Makie\NL7Xw\src\figureplotting.jl:28
 [5] #viz#1
   @ C:\Users\M K\.julia\packages\MakieCore\S8PkO\src\recipes.jl:31 [inlined]

```

Or did you mean something else while suggesting to use Makie.to\_color?  
Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 13, 2022, 12:31pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/12 "2022-05-13T12:31:13Z")

</div>

MeshViz.jl has its own color conversion mechanism for any Julia object

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 16, 2022, 6:57pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/13 "2022-05-16T18:57:34Z")

</div>

Now that I am back to my computer, let me explain what I meant by conversion mechanism.

The following file in MeshViz.jl defines the conversion mechanism:

> <https://github.com/JuliaGeometry/MeshViz.jl/blob/master/src/colors.jl>

Users can plot any Julia object as colors by adding a new method to the `ascolor` trait function:

```julia
# tell how to convert object into color
ascolor(obj::MyObj, scheme) = RGB(0,0,0)

```

We provide implementations for vector of numbers, colors, symbols, strings, categorical values, etc. So you can simply pass

```julia
color = [:red, :green, :blue, ...]

```

or

```julia
color = [RGB(255,0,0), RGB(0,255,0), RGB(0,0,255), ...]

```

or whatever object with well-defined `ascolor` method. Additionally, you can pass a vector of transparencies `alpha = [0.5, 0.2, 0.8, ...]`, which are always floats between 0 and 1 that override the transparency channel of specified colors.

---

<div class="post-metadata">

**Author:** ![KirillGerke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirillgerke/32/11383_2.png) [@KirillGerke](https://discourse.julialang.org/u/KirillGerke)\
**Post date:** [August 5, 2022, 9:26pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/14 "2022-08-05T21:26:25Z")

</div>

Julio,

Finally i set down to rework that. Before i just used an older version of the environment and the old code worked…

Now the working code looks like this:

```julia
using Meshes, MeshViz

import GLMakie as Mke

path = "/path/to/file.raw"
nvox = round(Int, filesize(path)^(1/3))
buff = zeros(UInt8, nvox, nvox, nvox)

stream = open(path, "r")
read!(stream, buff)
close(stream)

colors = replace(buff, 0 => :black, 1 => :orange)
alpha = replace(buff, 0 => 0.05, 1 => 0.5)

grid = CartesianGrid(nvox, nvox, nvox)
viz(grid, color = vec(colors), alpha = vec(alpha))

```

Btw, a question about crediting yours and Simon’s work in creating the packages. For Simon i could google this one:  
Danisch, S., & Krumbiegel, J. (2021). Makie. jl: Flexible high-performance data visualization for Julia. _Journal of Open Source Software_, _6_(65), 3349.  
But to credit your input, i did not find anything better than to refer to this one:  
Hoffimann, J. (2018). GeoStats. jl–High-performance geostatistics in Julia. _Journal of Open Source Software_, _3_(24), 692.

Again, thank you for all the answers!

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 5, 2022, 9:51pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/15 "2022-08-05T21:51:09Z")

</div>

Hi Kirill, thanks for considering giving credit to us, that is very kind of you. On my side there is active work in Meshes.jl and MeshViz.jl. The latter is just a set of visualization recipes optimized for the geometries and meshes of the former. These recipes are built with the Makie project that you already have a reference for.

I should probably add a DOI for Meshes.jl at some point. The reference you found on GeoStats.jl is for a more ambitious project on top of Meshes.jl.

---

<div class="post-metadata">

**Author:** ![almost6heads](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/almost6heads/32/210904_2.png) [@almost6heads](https://discourse.julialang.org/u/almost6heads)\
**Post date:** [July 25, 2024, 3:49pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/17 "2024-07-25T15:49:48Z")

</div>

Julio,

The above code using `Meshes`, `MeshViz`, and `GLMakie` works perfect for my purpose. But I have noticed that `MeshViz` has been archived and its functionality is now part of `Meshes`. But I cannot get the above code to work if I just use

```Julia
using Meshes
import GLMakie as Make

```

I get an error concerning the color specification. How would the above example have to be modified to cover the latest version of `Meshes`?

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [July 25, 2024, 4:01pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/18 "2024-07-25T16:01:26Z")

</div>

@almost6heads can you please double check the Meshes.jl version you are using? The two imports you shared are enough.

Please check the official documentation for additional examples.

---

<div class="post-metadata">

**Author:** ![almost6heads](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/almost6heads/32/210904_2.png) [@almost6heads](https://discourse.julialang.org/u/almost6heads)\
**Post date:** [July 25, 2024, 4:21pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/19 "2024-07-25T16:21:44Z")

</div>

Julio,

I have been looking at the documentation and have not been able to resolve this. That’s why is asked. Here is the code that I used:

```Julia
using Meshes
import GLMakie as Mke

nvox = 5
buff = zeros(UInt8, nvox, nvox, nvox)
buff[1,1,1] = 1
buff[2,3,4] = 1
buff[3,4,5] = 1

colors = replace(buff, 0 => :white, 1 => :blue)
alpha = replace(buff, 0 => 0.05, 1 => 0.7)

grid = CartesianGrid(nvox, nvox, nvox)
viz(grid, color = vec(colors), alpha = vec(alpha))

```

When I run it, I get the following error message:

```Julia
ERROR: MethodError: no method matching getcolors(::Colorfy.Colorfier{Vector{…}, Vector{…}, ColorSchemes.ColorScheme{…}, Symbol})

```

I am using `Meshes v0.47.0` and `GLMakie v0.10.5`. Any help would be appreciated. I am sorry for not being able to figure this out.

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [July 25, 2024, 4:29pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/20 "2024-07-25T16:29:12Z")

</div>

Will take a look into it soon. In the meantime, can you change the vector of colors to 1:nelements(grid) and see if it works ? We released v0.47 yesterday with a couple of breaking changes in the viz function.

---

<div class="post-metadata">

**Author:** ![almost6heads](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/almost6heads/32/210904_2.png) [@almost6heads](https://discourse.julialang.org/u/almost6heads)\
**Post date:** [July 25, 2024, 5:15pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/21 "2024-07-25T17:15:58Z")

</div>

Yes, it renders the image if I use `1:nelements(grid)`. It just does not accept the color names…

[Next page](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360.md?page=2)
