# 3d bars makie, colors and meshes

**URL:** <https://discourse.julialang.org/t/3d-bars-makie-colors-and-meshes/70283>\
**Category:** General Usage\
**Tags:** question, plotting, makie\
**Created:** [October 24, 2021, 9:01am UTC](https://discourse.julialang.org/t/3d-bars-makie-colors-and-meshes/70283 "2021-10-24T09:01:27Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)\
**Post date:** [October 24, 2021, 11:43am UTC](https://discourse.julialang.org/t/3d-bars-makie-colors-and-meshes/70283/6 "2021-10-24T11:43:47Z")

</div>

Oh sorry, I read over that part. I don’t think you can get that with `meshscatter` right now.

With `mesh` you could use `mesh!(ax, recmesh; color=last.(coordinates(recmesh)), colormap = :Spectral_11, colorrange = (0, 1), shading=false)` but that just intepolates between two colors:

 ![Screenshot from 2021-10-24 13-24-27](https://global.discourse-cdn.com/julialang/original/3X/d/5/d5dfb448e93e315598ae56ffe521579645d10bf7.png)

Alternatively you could work with a texture similar to [Issues · MakieOrg/Makie.jl · GitHub](https://github.com/JuliaPlots/Makie.jl/issues/1368:)

```julia
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
    texture = reshape(get(colorschemes[cbarPal], 0:0.01:1), 1, 101)
    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.normal_mesh(rectMesh)
        uvs = [Point2f(p[3], 0) for p in coordinates(recmesh)] # normalize this so zmax = 1
        recmesh = GeometryBasics.Mesh(
            meta(coordinates(recmesh); normals=normals(recmesh), uv = uvs), 
            faces(recmesh)
        )
        mesh!(ax, recmesh; color=texture, shading=false)
    end
    fig
end
test3dBars()

```

 ![Screenshot from 2021-10-24 13-38-44](https://global.discourse-cdn.com/julialang/original/3X/d/0/d043799f82e55f0f8252a3781e430f34f9516f13.jpeg)

> A way to merge all Rect3 meshes?

GeometryBasics implements `merge(meshes)`

---

_[View the full topic](https://discourse.julialang.org/t/3d-bars-makie-colors-and-meshes/70283)._
