# \[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:** 6\
**Page:** 2

<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, 6:02pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/22 "2024-07-25T18:02:39Z")

</div>

Thank you for reporting the issue @almost6heads , we are taking a look into it. Probably related to the major refactor we did this week.

We should come back soon with a fix.

---

<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, 6:36pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/23 "2024-07-25T18:36:09Z")

</div>

@almost6heads we checked the example internally and noticed that your vector of colors has `Any` as the element type:

```julia
julia> colors
5×5×5 Array{Any, 3}:
[:, :, 1] =
 :blue :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white

[:, :, 2] =
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white

[:, :, 3] =
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white

[:, :, 4] =
 :white :white :white :white :white
 :white :white :blue :white :white
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :white :white

[:, :, 5] =
 :white :white :white :white :white
 :white :white :white :white :white
 :white :white :white :blue :white
 :white :white :white :white :white
 :white :white :white :white :white

```

In the meantime, you can fix the type using:

```julia
colors = Symbol.(colors)

```

This should work.

---

<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, 6:47pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/24 "2024-07-25T18:47:57Z")

</div>

Yes, that works! Thank you so much for your quick help.

---

<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, 6:58pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/25 "2024-07-25T18:58:00Z")

</div>

You are welcome. You may be interested in the new Makie.voxels function if your colors are restricted to a pre-defined set of colors:

> [@Handling colors in new \`Makie.voxels\` function](https://discourse.julialang.org/t/handling-colors-in-new-makie-voxels-function/115251):
>
> The new voxels function was introduced in Makie v0.21 to plot 3D Cartesian grids more efficiently. However, it assumes Array{\<:Real,3} for the colors. Can it sill be used with general Colors.jl colors? It is easy to convert Gray to Real, but multi-channel colors (e.g. RGB) cannot be converted to Gray without loss.

It can render larger grids based on that assumption.

---

<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, 8:46pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/26 "2024-07-25T20:46:47Z")

</div>

@almost6heads we fixed the issue in Colorfy.jl and the new release should come out soon:

> <https://github.com/JuliaRegistries/General/pull/111791>
>
> \- Registering package: Colorfy
> \- Repository: https://github.com/JuliaGraphics/Co…lorfy.jl
> \- Created by: @juliohm
> \- Version: v0.1.6
> \- Commit: 186dcf8a416ca07f22005a66c234eccf460629f8
> \- Reviewed by: @juliohm
> \- Reference: https://github.com/JuliaGraphics/Colorfy.jl/commit/186dcf8a416ca07f22005a66c234eccf460629f8#commitcomment-144650568
> \- Description: Colorfy Julia objects

You can update your environment when the PR above is merged by the robots. Vectors of `Any` colors are better handled now, with a more informative error message.

---

<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, 9:39pm UTC](https://discourse.julialang.org/t/makie-jl-3d-voxelized-visualization-of-a-cubical-matrix/77360/27 "2024-07-25T21:39:24Z")

</div>

Great, thanks again!

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