# Hexahedron volume plot

**URL:** <https://discourse.julialang.org/t/hexahedron-volume-plot/131489>\
**Category:** Visualization\
**Tags:** makie, meshes\
**Created:** [August 9, 2025, 1:56pm UTC](https://discourse.julialang.org/t/hexahedron-volume-plot/131489 "2025-08-09T13:56:44Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [August 29, 2025, 10:34pm UTC](https://discourse.julialang.org/t/hexahedron-volume-plot/131489/5 "2025-08-29T22:34:59Z")

</div>

> [@ffreyer](#):
>
> I think the main thing you need is a function that tells you the color which should go at a given position.

I have found a way to get the color value for each vertex position of a mesh element. I took average of color values of all elements adjacent to a vertex as color of that vertex.

> [@Adjacent elements of a Vertex in Meshes.jl](https://discourse.julialang.org/t/adjacent-elements-of-a-vertex-in-meshes-jl/131900/3):
>
> ```julia-auto
> vertex_color = Float64[]
> for i in 1:nelements(g)
> el= element(g,i)
> bd = Boundary{3,0}(topology(g))(i)	#Ntuple of vertex ids of i-th element
> for id in bd
> adels= Coboundary{0,3}(topology(g))(id)	#Ntuple of element ids adjacent to this vertex
> clct = collect(Element_color[(elem2cart(topology(g),idx))...] for idx in adels)	#position of i-th element in grid	
> push!(vertex_color, sum(clct)/length(clct))
> end
> @inline viz!(el, color =vertex_color, alpha=0.2)
> #@show clr
> end
> 
> ```

Now i have color value for each vertex in mesh element.

- Can it be done that i subdivide/tesselate these Hexahedron elements into small cuboids 🧊 and interpolate these colors to cuboids vertices and get volume plot of these cuboids and then stitch together ? My mesh has these two types of many Hexahedrons.  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/3/3314c806d4cad9750a84b9f66cf0fa7a52bab68e.png) for `element(g,1)`  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/2/e2d3e3ce44c7d0dda685b3f5d815fb170aea2615.png) for `element(g,2)`

---

_[View the full topic](https://discourse.julialang.org/t/hexahedron-volume-plot/131489)._
