Probably, the following could be done without to much effort, but I don’t seem to find the right way to do it
- A way to merge all Rect3 meshes? Plotting one by one becomes really slow after a while.
- Add a color gradient to each rectangle as a function of
z
. Namely, the colormap maps each rectangle.
This is the start:
using GeometryBasics, GLMakie, ColorSchemes
function test3dBars()
x = y= 1:10
z = rand(10,10)
δx = (x[2] - x[1]) / 2
δy = (y[2] - y[1]) / 2
cbarPal = :Spectral_11
ztmp = (z .- minimum(z)) ./ (maximum(z .- minimum(z)))
cmap = get(colorschemes[cbarPal], ztmp)
cmap2 = reshape(cmap, size(z))
fig = Figure(resolution=(1200, 800), fontsize=26)
ax = Axis3(fig[1, 1]; aspect=(1, 1, 1), elevation=π / 6, perspectiveness=0.5)
for (idx, i) in enumerate(x), (idy, j) in enumerate(y)
rectMesh = FRect3D(Vec3f0(i - δx, j - δy, 0), Vec3f0(2δx, 2δy, z[idx, idy]))
recmesh = GeometryBasics.mesh(rectMesh)
mesh!(ax, recmesh; color=cmap2[idx, idy], shading=false)
end
fig
end
test3dBars()