# Is there an efficient way that the xticks and yticks numbers appear in LaTeX using Makie?

**URL:** <https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064>\
**Category:** Visualization\
**Tags:** question, latex\
**Created:** [February 9, 2022, 8:17am UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064 "2022-02-09T08:17:42Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [February 9, 2022, 8:17am UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064/1 "2022-02-09T08:17:42Z")

</div>

I open this question because I have not been able to set the Computer Modern font in Makie. The only workaround I found to write the numbers of the x and y axis in LaTeX is to extract the attribute from the plot that contains these numbers and manually changing them to LaTeX with the notation L"number" and then putting them back into the corresponding attributes that contains these labels.

However, I think that there should be a way where you just change the font of the whole plot but I did not manage to find it in the documentation or other related questions.

---

<div class="post-metadata">

**Author:** ![Wemko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wemko/32/33624_2.png) [@Wemko](https://discourse.julialang.org/u/Wemko)\
**Post date:** [February 9, 2022, 10:31am UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064/2 "2022-02-09T10:31:52Z")

</div>

```plaintext
using GLMakie

function example_plot(;font, fontsize)
    f = Figure(font = font, fontsize = fontsize)
    lines(f[1, 1], cumsum(randn(50)))
    f
end

example_plot(font = "Computer Modern", fontsize = 30)

```

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

---

<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:** [February 9, 2022, 10:43am UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064/3 "2022-02-09T10:43:40Z")

</div>

Thank you for your response! But that does not look like LaTeX right?

In this other [example](https://discourse.julialang.org/t/nice-fonts-with-plots-gr-and-latexstrings/60037), using the Plots package, that font produces LaTeX figures. When I run the code using “Computer Modern” with Makie I get a message saying that font does not exist and if defaults to “Dejavu Sans”

---

<div class="post-metadata">

**Author:** ![Wemko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wemko/32/33624_2.png) [@Wemko](https://discourse.julialang.org/u/Wemko)\
**Post date:** [February 9, 2022, 11:29am UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064/4 "2022-02-09T11:29:47Z")

</div>

Yes. Maybe something is wrong with “Computer Modern” font in my laptop, so I install a new “Computer Modern” font and it looks right now.

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

And, It seems you got the message because Makie did not find the font in your computer. It`s a general issue in [Frequently Asked Questions (juliaplots.org)](https://makie.juliaplots.org/stable/documentation/faq/index.html).

> If `Makie` can’t find your font, you can do two things:
> 
> 1. Check that the name matches and that the font is in one of the directories in:
> 
> - `using FreeTypeAbstraction; FreeTypeAbstraction.valid_fontpaths`
> 
> 1. You can add a custom font path via the environment variable:
> 
> - `ENV["FREETYPE_ABSTRACTION_FONT_PATH"] = "/path/to/your/fonts"`
> 
> 1. Specify the path to the font; instead of `font = "Noto"` , you could write `joindir(homedir(), "Noto.ttf")` or something.

Good luck!

---

<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:** [February 9, 2022, 1:01pm UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-that-the-xticks-and-yticks-numbers-appear-in-latex-using-makie/76064/5 "2022-02-09T13:01:36Z")

</div>

> [@Wemko](#):
>
> ```julia
> using GLMakie
> 
> function example_plot(;font, fontsize)
> f = Figure(font = font, fontsize = fontsize)
> lines(f[1, 1], cumsum(randn(50)))
> f
> end
> 
> example_plot(font = "Computer Modern", fontsize = 30)
> 
> ```

Okay now it works! Thank you very much!
