# LaTeX z-label in 3D Makie plot

**URL:** <https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369>\
**Category:** General Usage\
**Tags:** plotting, makie, latexstrings\
**Created:** [May 2, 2022, 2:46pm UTC](https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369 "2022-05-02T14:46:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [May 2, 2022, 2:46pm UTC](https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369/1 "2022-05-02T14:46:18Z")

</div>

I want to make a 3D surface plot in Makie, and I need the z-axis label to be formatted with \LaTeX. Whenever I add such a label, all the content in the plot disappears. For example, the following plot works without adding an `L` prefix to the z-label:

```julia
using CairoMakie
x = collect(-2:0.01:2) 
y = collect(-2:0.01:2)
Z = [1/(1+(x+im*y)^2) for y in y, x in x]
fig = Figure()
ax = Axis3(fig[1, 1], zlabel = "|1/(1+z^2)|")
surface!(ax, x, y, abs.(Z))
zlims!(ax, 0, 5)

```

Once I try and format the z-label into \LaTeX:

```julia
x = collect(-2:0.01:2) 
y = collect(-2:0.01:2)
Z = [1/(1+(x+im*y)^2) for y in y, x in x]
fig = Figure()
ax = Axis3(fig[1, 1], zlabel = L"|1/(1+z^2)|")
surface!(ax, x, y, abs.(Z))
zlims!(ax, 0, 5)

```

everything in the plot disappears.

Am I doing something wrong here, or is there a way around this?

---

<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 2, 2022, 3:56pm UTC](https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369/2 "2022-05-02T15:56:59Z")

</div>

Hm if everything disappears could it be some bug with this particular latex expression? What about just `L"x"` just to make sure it’s not that

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [May 2, 2022, 4:09pm UTC](https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369/3 "2022-05-02T16:09:33Z")

</div>

That also seems to break it, no latex expression I’ve tried seems to work. It also seems to only be for the z-axis label, e.g. the following works with a latex x-label:

```julia
using CairoMakie
x = collect(-2:0.01:2) 
y = collect(-2:0.01:2)
Z = [1/(1+(x+im*y)^2) for y in y, x in x]
fig = Figure()
ax = Axis3(fig[1, 1], zlabel = "z", xlabel = L"x")
surface!(ax, x, y, abs.(Z))
zlims!(ax, 0, 5)

```

---

<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 2, 2022, 4:22pm UTC](https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369/4 "2022-05-02T16:22:48Z")

</div>

Oh that sounds weird, I’ll have to take a look at t some point. Could you please file an issue with your example code?

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [May 2, 2022, 4:26pm UTC](https://discourse.julialang.org/t/latex-z-label-in-3d-makie-plot/80369/5 "2022-05-02T16:26:57Z")

</div>

Done - I should have done that to start with but figured it was a mistake on my part. Thanks.
