# Trouble plotting multiple spheres in GLMakie

**URL:** <https://discourse.julialang.org/t/trouble-plotting-multiple-spheres-in-glmakie/88387>\
**Category:** Visualization\
**Created:** [October 7, 2022, 6:41am UTC](https://discourse.julialang.org/t/trouble-plotting-multiple-spheres-in-glmakie/88387 "2022-10-07T06:41:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mervyn\_Larrier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mervyn_larrier/32/37709_2.png) [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)\
**Post date:** [October 7, 2022, 6:41am UTC](https://discourse.julialang.org/t/trouble-plotting-multiple-spheres-in-glmakie/88387/1 "2022-10-07T06:41:49Z")

</div>

I would like to plot a sphere inside another sphere. I’m using a wireframe to easily see the intersection in the spheres (if any exist), but I’m open to mesh solutions as well. The code compiles, but it won’t visualize; rather, I get this message instead: Combined{Makie.wireframe,Tuple{Array{Float64,2},Array{Float64,2},Array{Float64,2}}}.  
I’m fairly new to Makie so any help would be appreciated.  
P.S.: I know the spheres won’t intersect as I have them described, I just wanted to get them on the same graph before I tried moving them around.

```julia
using GLMakie

θ,ϕ = collect(0:π/24:2π), collect(0:π/24:π)
r = 900;
c = 400;
x = [r*sin(Φ)*cos(Θ) for Φ ∈ ϕ, Θ ∈ θ];
y = [r*sin(Φ)*sin(Θ) for Φ ∈ ϕ, Θ ∈ θ];
z = [r*cos(Φ) for Φ ∈ ϕ, Θ ∈ θ];

fig = Figure(resolution = (600,400))
ax = Axis(fig[1,1], xlabel="x-label", ylabel = "y-label", zlabel = "z-label", Title = "Title")
wireframe(x,y,z, axis = (type=Axis3,), color=:blue)

x1 = [c*sin(Φ)*cos(Θ) for Φ ∈ ϕ, Θ ∈ θ];
y1 = [c*sin(Φ)*sin(Θ) for Φ ∈ ϕ, Θ ∈ θ];
z1 = [c*cos(Φ) for Φ ∈ ϕ, Θ ∈ θ];
wireframe!(ax,x1,y1,z1, axis = (type=Axis3,), color =:green)

```

---

<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:** [October 7, 2022, 8:26am UTC](https://discourse.julialang.org/t/trouble-plotting-multiple-spheres-in-glmakie/88387/2 "2022-10-07T08:26:54Z")

</div>

you are missing a few `!`, also, once you define an axis3 you don’t call it again. Here, the working example:

```nohighlight
using GLMakie

θ,ϕ = collect(0:π/24:2π), collect(0:π/24:π)
r = 900;
c = 400;
x = [r*sin(Φ)*cos(Θ) for Φ ∈ ϕ, Θ ∈ θ];
y = [r*sin(Φ)*sin(Θ) for Φ ∈ ϕ, Θ ∈ θ];
z = [r*cos(Φ) for Φ ∈ ϕ, Θ ∈ θ];

x1 = [c*sin(Φ)*cos(Θ) for Φ ∈ ϕ, Θ ∈ θ];
y1 = [c*sin(Φ)*sin(Θ) for Φ ∈ ϕ, Θ ∈ θ];
z1 = [c*cos(Φ) for Φ ∈ ϕ, Θ ∈ θ];

fig = Figure(resolution = (600,400))
ax = Axis3(fig[1,1], xlabel="x-label", ylabel = "y-label", zlabel = "z-label")
wireframe!(ax, x,y,z, color=:blue, transparency = true)
wireframe!(ax, x1,y1,z1, color =:green, transparency=true)
fig

```

also, I would recommend using transparency=true for a better output effect. The `title` arg is not supported.

---

<div class="post-metadata">

**Author:** ![Mervyn\_Larrier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mervyn_larrier/32/37709_2.png) [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)\
**Post date:** [October 7, 2022, 11:27pm UTC](https://discourse.julialang.org/t/trouble-plotting-multiple-spheres-in-glmakie/88387/3 "2022-10-07T23:27:09Z")

</div>

Thank you!
