# Latex Strings in Makie Axis Ticks

**URL:** <https://discourse.julialang.org/t/latex-strings-in-makie-axis-ticks/80729>\
**Category:** Visualization\
**Tags:** makie, latexstrings\
**Created:** [May 9, 2022, 2:15am UTC](https://discourse.julialang.org/t/latex-strings-in-makie-axis-ticks/80729 "2022-05-09T02:15:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Whyborn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/whyborn/32/34755_2.png) [@Whyborn](https://discourse.julialang.org/u/Whyborn)\
**Post date:** [May 9, 2022, 2:15am UTC](https://discourse.julialang.org/t/latex-strings-in-makie-axis-ticks/80729/1 "2022-05-09T02:15:53Z")

</div>

Hi,

I have been having some issues with generating my desired tick labels in Makie. I would like to use LaTeX style formatting (for example \rho\_{B}). Unfortunately, Makie does not seem to accept LatexStrings for the axis ticks. For example;

```julia
using GLMakie, LaTeXStrings

# Create some dummy data
x = 0:0.05:1
y = 0:0.05:1

f(x, y) = 2 * cos(5 * x - 2 * y) + 3 * sin(3 * x + 4 * y)

z = f.(x, y')

# Create the figure, make it a 3D plot with specified ticks
fig = Figure()
# These don't work
#xtcks = ([0.1, 0.8], [L"\rho_{b}", L"\rho_{E}"])
#ytcks = ([0.2, 0.6], [L"\alpha_{b}", L"\alpha_{E}"])

# These run, but doesn't render the expected outcome.
xtcks = ([0.1, 0.8], ["\$\\rho_{B}\$", "\$\\rho_{E}\$"])
ytcks = ([0.2, 0.6], ["b", "E"])

# In the axis label, works exactly as expected.
ax = Axis3(fig[1, 1], xticks = xtcks, yticks = ytcks, xlabel = L"$\rho_{B}$")

surf = surface!(ax, x, y, z)
# fig

```

Attempting to use the LaTeXString version of the ticks yields the error

```julia
TypeError: in typeassert, expected Vector{Tuple{String, Point{2, Float32}}}, got a value of type Vector{Tuple{LaTeXString, Point{2, Float32}}}

```

If LaTeXStrings are not usable in axis ticks, what would be the best way to get the desired outcome like the one shown in the axis label? I casting the LaTeXString to string using `julia String()` but that did work either.

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [May 9, 2022, 10:04am UTC](https://discourse.julialang.org/t/latex-strings-in-makie-axis-ticks/80729/2 "2022-05-09T10:04:36Z")

</div>

I know this can be done in 2D plots. Maybe it is an oversight of 3D plots that the multiple dispatch does not allow for a LaTeXString object to go into the ticks?

---

<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 9, 2022, 3:20pm UTC](https://discourse.julialang.org/t/latex-strings-in-makie-axis-ticks/80729/3 "2022-05-09T15:20:55Z")

</div>

Probably Axis3 has too strict typing in some places that is set up as String were LatexString is then not allowed anymore.
