# Unwanted clipping at corners of GLMakie 3d plot

**URL:** https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053
**Category:** General Usage
**Tags:** plotting, 3d, glmakie
**Created:** [July 25, 2025, 1:38pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053 "2025-07-25T13:38:32Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![fegomezl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fegomezl/32/217899_2.png) [@fegomezl](https://discourse.julialang.org/u/fegomezl)
#### Post date: [July 25, 2025, 1:38pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/1 "2025-07-25T13:38:32Z")

</div>

Hi everyone,

I am using contour() from GLMakie to create a 3d level plot. My problem occurs when I zoom in; white triangles appear at the edges of the box, which cover my plot:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/4/f4596399aad1b1b86c75b92cc5022631effa2c61.png)

Does someone know how to fix this? I have been trying to play with the parameters of Axis3(), but I have not found a solution yet. Here is my code:

```julia-auto
fig = Figure(size = (500, 600), dpi = 500)

xlabel = L"x/ξ"
ylabel = L"y/ξ"
zlabel = L"z/ξ"
titlesize = 20
xlabelsize = 20
ylabelsize = 20
zlabelsize = 20
xgridvisible = false
ygridvisible = false
zgridvisible = false

ax = Axis3(fig[1,1]; xlabel, xlabelsize, ylabel, ylabelsize, zlabel, zlabelsize, xgridvisible, ygridvisible, zgridvisible, 
                     aspect = (1,1,1), perspectiveness = 0.5, elevation = 0.5, azimuth = 4)

dom = (0, L*(1-2.0^(-N)))
ctr = contour!(dom, dom, dom, abs2.(ψ); levels = [0, 0.02, 0.04, 0.06, 0.08, 0.1], colormap = [:blue])

α = 0.8
limits!(ax, L/2 - α*L/2, L/2 + α*L/2, L/2 - α*L/2, L/2 + α*L/2, L/2 - α*L/2, L/2 + α*L/2)

display(fig)

```

---

<div class="post-metadata">

### Author: ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)
#### Post date: [July 25, 2025, 4:13pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/2 "2025-07-25T16:13:16Z")

</div>

Hi, and welcome to the Julia community!

Could you provide definitions for the missing variables (`L`, `N`, `ψ`) to make your code into a full MWE?

---

<div class="post-metadata">

### Author: ![fegomezl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fegomezl/32/217899_2.png) [@fegomezl](https://discourse.julialang.org/u/fegomezl)
#### Post date: [July 25, 2025, 4:25pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/3 "2025-07-25T16:25:57Z")

</div>

Sure, here is the creation of the array ψ, which defines the ring I plotted. L is the size of the box (without zoom), and N sets the grid size (2^N points per axis):

```julia-auto
"""
    Dipole vortex core structure
"""
function VortexRingWaveFunction(x::Real, y::Real, z::Real, L::Real, R::Real)
    # Padé approximation constants
    a1 = 11/32
    b1 = (5-32*a1)/(48-192a1)
    a2 = a1*(b1-1/4)
    b2 = a2

    # Calculate variables
    r = hypot(x-L/2, y-L/2)
    r1 = hypot(r-R, z-L/2)
    r2 = hypot(r+R, z-L/2)

    ρ1 = r1^2*(a1+a2*r1^2)/(1+b1*r1^2+b2*r1^4)
    ρ2 = r2^2*(a1+a2*r2^2)/(1+b1*r2^2+b2*r2^4)

    return √(ρ1*ρ2)
end

L = 32
N = 7
R = 5

x_list = collect(LinRange(0,L,2^N+1)[1:end-1])
y_list = collect(LinRange(0,L,2^N+1)[1:end-1])
z_list = collect(LinRange(0,L,2^N+1)[1:end-1])
ψ = zeros(ComplexF64, 2^N, 2^N, 2^N)
for (n, x) in enumerate(x_list)
    for (m, y) in enumerate(y_list)
        for (l, z) in enumerate(z_list)
            ψ[n,m,l] = VortexRingWaveFunction(x, y, z, L, R)
        end
    end
end

```

---

<div class="post-metadata">

### Author: ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)
#### Post date: [July 25, 2025, 5:21pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/4 "2025-07-25T17:21:12Z")

</div>

That looks like a bug for `Axis3` in combination with `contour`. For a more minimal MWE, consider

```julia
using GLMakie

xs = ys = zs = -1.5:0.1:1.5
ws = [x^2 + y^2 + z^2 for x in xs, y in ys, z in zs] # contour surfaces are spheres

fig = Figure()
ax = Axis3(fig[1, 1])
contour!(ax, ws, levels=[1.])
display(fig)

```

 ![CornerTriangle](https://global.discourse-cdn.com/julialang/original/3X/d/5/d563da4525a76144b68cd82836f2dbf8ce4d6709.png)

Note that this works fine with `LScene` instead of `Axis3`.

---

<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: [July 25, 2025, 5:21pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/5 "2025-07-25T17:21:52Z")

</div>

@ffreyer

---

<div class="post-metadata">

### Author: ![fegomezl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fegomezl/32/217899_2.png) [@fegomezl](https://discourse.julialang.org/u/fegomezl)
#### Post date: [July 25, 2025, 8:32pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/6 "2025-07-25T20:32:36Z")

</div>

Thank you very much, yes this works great.

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [July 26, 2025, 12:22pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/7 "2025-07-26T12:22:56Z")

</div>

Ah interesting, this happens when you scroll around. Maybe the contour has some kind of depth shift? It looks like the clip planes are applying too early somehow.

---

<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: [July 29, 2025, 2:22pm UTC](https://discourse.julialang.org/t/unwanted-clipping-at-corners-of-glmakie-3d-plot/131053/8 "2025-07-29T14:22:39Z")

</div>

[Ignore volume box z values by ffreyer · Pull Request #5225 · MakieOrg/Makie.jl · GitHub](https://github.com/MakieOrg/Makie.jl/pull/5225) fixes that
