Subscript in label

Hello! I have a very simple question but unfortunatly, I don’t find any solution only.
I am plotting using GLMakie and I want to write the labels of my plot :

ax2 = GLMakie.Axis(f[2,1], xlabel = "Time since start of CO_2 injection", ylabel = "Temperature [°C]")

How can I write the 2 in the xlabel in subscript. I have the feeling that I tried everything…
Thanks :slight_smile:

1 Like

You can just put in (type \_2<TAB>)

e.g. ax=Axis(fig[1,1], xlabel = "Blah₂"); works

2 Likes

Or you use rich text for arbitrary subscripts (not every char exists as a unicode subscript)

2 Likes

Just to add to Jules’ answer, lately I have found it useful to define some rich text elements early on so that it’s easy to include them later on, e.g.:

CO2 = rich("CO", subscript("2"))
ax = Axis(f[1,1], xlabel = rich("Time since start of ", CO2, " injection"), ylabel = "Temperature [°C]")

gives something like

2 Likes