Making 3D text appear 2D GLMakie


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.

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!


what’s your current code?

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

> 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))

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

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.

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

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