# Making 3D text appear 2D GLMakie

**URL:** <https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404>\
**Category:** General Usage\
**Tags:** question, plotting, makie, glmakie\
**Created:** [April 23, 2024, 3:59pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404 "2024-04-23T15:59:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gavin\_Held](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gavin_held/32/49350_2.png) [@Gavin\_Held](https://discourse.julialang.org/u/Gavin_Held)\
**Post date:** [April 23, 2024, 3:59pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/1 "2024-04-23T15:59:19Z")

</div>

Hello,

I am currently trying to make a nice figure with GLMakie that will help aid in describing a specific geometry. To do this I want to include the basis vectors that go along with it, however, I am having difficulties getting the text labels to look nice.

 ![Screenshot from 2024-04-23 10-48-52](https://global.discourse-cdn.com/julialang/original/3X/e/f/efdf384a1975538cfc66d6975e31af6ca1ff551c.png)

Currently, (as seen above) the text lies in the Cartesian X-Y plane. What I would like to happen is have the text appear 2D relative to my screen, but use the 3D location relative to the figure. I am using an LScene() with the text!() functionality. If there are any fixes (easy or hard), I would love to hear!

Thanks.

---

<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:** [April 23, 2024, 4:00pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/2 "2024-04-23T16:00:24Z")

</div>

what’s your current code?

---

<div class="post-metadata">

**Author:** ![Gavin\_Held](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gavin_held/32/49350_2.png) [@Gavin\_Held](https://discourse.julialang.org/u/Gavin_Held)\
**Post date:** [April 23, 2024, 4:03pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/3 "2024-04-23T16:03:42Z")

</div>

The whole code is a bit complex and needs a lot of complementary things, but for producing the vectors and labels, the code is:

```julia
> fig = Figure(size=(1920,1080))
> ax = LScene(fig[1,1],show_axis=false)
> x_dir = fluxTube.gridpoints[2,1,z] .- fluxTube.gridpoints[1,1,z]
> y_dir = fluxTube.gridpoints[1,2,z] .- fluxTube.gridpoints[1,1,z]
> point = fluxTube.gridpoints[20,20,z]
> arrows!(ax3,Point3f.([point,point]),Vec3f.([x_dir,y_dir])/25,arrowsize=arrowsize,shininess=0.0)
> text!(ax3,Point3f.([point.+x_dir/25,point.+y_dir/25]),text=["x⃗","y⃗"],fontsize = 0.05,markerspace = :data,align=(:left,:bottom))

```

---

<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:** [April 23, 2024, 5:26pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/4 "2024-04-23T17:26:46Z")

</div>

It sounds like you don’t want to be setting markerspace to :data

---

<div class="post-metadata">

**Author:** ![Gavin\_Held](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gavin_held/32/49350_2.png) [@Gavin\_Held](https://discourse.julialang.org/u/Gavin_Held)\
**Post date:** [April 23, 2024, 5:58pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/5 "2024-04-23T17:58:59Z")

</div>

I agree with that to a point, but the only other option I know of is the default :pixel setting. However, I don’t like that because zooming in and out changes how large the font is.

---

<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:** [April 23, 2024, 6:47pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/6 "2024-04-23T18:47:21Z")

</div>

The font size always stays the same in screen umits, I guess you mean that its relative size changes vs the thing you zoom. I see, ok yeah that option for text doesn’t exist that you’d like, data space size but billboarded

---

<div class="post-metadata">

**Author:** ![Gavin\_Held](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gavin_held/32/49350_2.png) [@Gavin\_Held](https://discourse.julialang.org/u/Gavin_Held)\
**Post date:** [April 25, 2024, 4:26pm UTC](https://discourse.julialang.org/t/making-3d-text-appear-2d-glmakie/113404/7 "2024-04-25T16:26:26Z")

</div>

I suppose that will have to do. I guess I will just play around with the fontsize until I get something that I like.

Thanks.
