# Sphere surface and axes artefact in Makie.jl

**URL:** <https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261>\
**Category:** Performance\
**Tags:** question, package, plotting, glmakie\
**Created:** [May 23, 2025, 2:23am UTC](https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261 "2025-05-23T02:23:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leespen1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leespen1/32/221928_2.png) [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Post date:** [May 23, 2025, 2:23am UTC](https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261/1 "2025-05-23T02:23:26Z")

</div>

I am trying to plot points on the Bloch sphere using GLMakie, but I get white lines around the lines I use to draw the sphere:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/0/a054d3aeefc6b4e62ead2cb5593aebde8177bcec.png)

Is there anything I can do to fix this? The script I used to generate the plot is below. I use `lines!` to draw contours of the sphere, and `surface!` to draw the transparent sphere.

```julia
using GLMakie

function bloch_sphere()
    fig = Figure()
    ax = Axis3(fig[1, 1], aspect = :data, azimuth = pi/6, elevation = pi/8)
    horizontal_circle = [Point3f(cospi(x), sinpi(x), 0) for x in LinRange(0,2,100)]
    vertical_circle = [Point3f(cospi(x), 0, sinpi(x)) for x in LinRange(0,2,100)]
    n = 50
    sx = zeros(n,n)
    sy = zeros(n,n)
    sz = zeros(n,n)
    φs = LinRange(0, 2pi, n)
    θs = LinRange(0, pi, n)
    for i in 1:n
        for j in 1:n
            sx[i,j] = cos(φs[i])*sin(θs[j])
            sy[i,j] = sin(φs[i])*sin(θs[j])
            sz[i,j] = cos(θs[j])
        end
    end
    surface!(ax, sx, sy, sz, color=fill(:gray, n, n), alpha=0.5, transparency=true,
            invert_normals=true)
    lines!(ax, horizontal_circle, color=:black)
    lines!(ax, vertical_circle, color=:black)
    lines!(ax, [Point3f(-1,0,0), Point3f(1,0,0)], color=:black)
    lines!(ax, [Point3f(0,-1,0), Point3f(0,1,0)], color=:black)

    limits!(ax, -1.1, 1.1, -1.1, 1.1, -1.1, 1.1)

    fig
end

fig = bloch_sphere()

```

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [May 23, 2025, 7:04am UTC](https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261/2 "2025-05-23T07:04:24Z")

</div>

apply `transparency` also to `lines`.

---

<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:** [May 23, 2025, 7:33am UTC](https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261/3 "2025-05-23T07:33:16Z")

</div>

This section is also relevant

> **[linesegments | Makie](https://docs.makie.org/stable/reference/plots/linesegments#Dealing-with-outline-artifacts-in-GLMakie)**
>
> Create impressive data visualizations with Makie, the plotting ecosystem for the Julia language. Build aesthetic plots with beautiful customizable themes, control every last detail of publication quality vector graphics, assemble complex layouts and...

---

<div class="post-metadata">

**Author:** ![leespen1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leespen1/32/221928_2.png) [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Post date:** [May 23, 2025, 6:10pm UTC](https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261/4 "2025-05-23T18:10:49Z")

</div>

That works great, thanks!

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/3/83d77643b6f1c9d5269bc629a2cedafc84405ca0.png)

---

<div class="post-metadata">

**Author:** ![leespen1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leespen1/32/221928_2.png) [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Post date:** [May 23, 2025, 6:12pm UTC](https://discourse.julialang.org/t/sphere-surface-and-axes-artefact-in-makie-jl/129261/5 "2025-05-23T18:12:39Z")

</div>

Thanks, that also fixes my problem (with more detail for other cases / solutions as well).
