# GLMakie Box(f\[1,1\]) hides Axis3 content

**URL:** https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868
**Category:** Visualization
**Tags:** makie
**Created:** [January 16, 2024, 1:18pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868 "2024-01-16T13:18:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [January 16, 2024, 1:18pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868/1 "2024-01-16T13:18:30Z")

</div>

I’m using the Box function with different colours to differentiate between panels in my figure.

The issue I’m having is that the Box hides the Axis3 lines and the axis contents. Is there a known way around this? I do remember reading somewhere in the docs that GLMakie has issues with transparency, but I’m not sure if that relates to this specific problem as the Axis is fine and the Axis3 is not.

CairoMakie output:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/d/ede8242d10a750351baf985eb5b639e431d1e99f.png)

GLMakie output:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/1/81e0107ab3860f2443f9490f54614e246b7864a0.png)

Code used:

```julia
    f = Figure()

    Box(f[1,1],color = (:red, 0.1))
    ax = Axis(f[1,1],alignmode=Outside())
    scatter!(ax,rand(100),rand(100))

    Box(f[1,2],color = (:blue, 0.1))
    ax = Axis3(f[1,2],alignmode=Outside())
    scatter!(ax,rand(100),rand(100),rand(100))

    f

```

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [January 16, 2024, 2:24pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868/2 "2024-01-16T14:24:57Z")

</div>

Try it with backwards translation like shown here [How to draw boxes around subfigures · Makie](https://docs.makie.org/stable/how-to/draw-boxes-around-subfigures/)

GLMakie has a zbuffer while CairoMakie draws things sequentially, that’s where the difference stems from.

---

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [January 16, 2024, 2:33pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868/3 "2024-01-16T14:33:30Z")

</div>

That doesn’t seem to work for this. Here is the example from that webpage with one of the `Axis` changed to an `Axis3`, using GLMakie:

![image](https://global.discourse-cdn.com/julialang/original/3X/6/b/6b8cc227a4ecf023599b393a529a6dbdcacb9ee7.png)

edit: and just to clarify, I did this for my specific example which didn’t seem to work:

```julia
begin
    f = Figure()
    
    box1=Box(f[1,1],color = (:red, 0.1))
    box2=Box(f[1,2],color = (:blue, 0.2))

    #added these lines:
    translate!(box1.blockscene,0,0,-100)
    translate!(box2.blockscene,0,0,-100)
    
    ax = Axis(f[1,1],alignmode=Outside(),backgroundcolor = (:blue, 0.2))
    scatter!(ax,rand(100),rand(100))

    ax = Axis3(f[1,2],alignmode=Outside(),backgroundcolor = (:blue, 0.2))
    scatter!(ax,rand(100),rand(100),rand(100))

    f
end

```

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [January 16, 2024, 2:39pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868/4 "2024-01-16T14:39:55Z")

</div>

What if you make the translation -5000 or -10000?

---

<div class="post-metadata">

### Author: ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)
#### Post date: [January 16, 2024, 2:45pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868/5 "2024-01-16T14:45:20Z")

</div>

That helped, thanks very much. It seems like the 2D Axis and 3D Axis panels start to go in front of the box at different numbers, which is interesting

With -10000:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/8/784a0c0813c8ce603a008c5e26ce9aacb9fece56.png)

and -50000:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/7/d7dcc057267532a136bba5008af32f64fab43441.png)

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [January 16, 2024, 5:21pm UTC](https://discourse.julialang.org/t/glmakie-box-f-1-1-hides-axis3-content/108868/6 "2024-01-16T17:21:12Z")

</div>

hm weird but at -50000 the boxes aren’t rendered at all anymore. There’s a limit to how far back you can go, I thought it was -10,000. It’s because in OpenGL rendering there’s a near and far value outside of which nothing is rendered.
