# Subscript in label

**URL:** https://discourse.julialang.org/t/subscript-in-label/118620
**Category:** New to Julia
**Tags:** plotting, glmakie
**Created:** [August 26, 2024, 1:03pm UTC](https://discourse.julialang.org/t/subscript-in-label/118620 "2024-08-26T13:03:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![NaSi](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@NaSi](https://discourse.julialang.org/u/NaSi)
#### Post date: [August 26, 2024, 1:03pm UTC](https://discourse.julialang.org/t/subscript-in-label/118620/1 "2024-08-26T13:03:03Z")

</div>

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 :

```julia
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 🙂

---

<div class="post-metadata">

### Author: ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)
#### Post date: [August 26, 2024, 1:06pm UTC](https://discourse.julialang.org/t/subscript-in-label/118620/2 "2024-08-26T13:06:16Z")

</div>

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

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

---

<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: [August 26, 2024, 4:03pm UTC](https://discourse.julialang.org/t/subscript-in-label/118620/3 "2024-08-26T16:03:18Z")

</div>

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

> **[text | Makie](https://docs.makie.org/stable/reference/plots/text#Rich-text)**
>
> Create impressive data visualizations with Makie, the plotting ecosystem for the Julia language. Build aesthetic plots with beautiful customizable themes, control every last detail of publication quality vector graphics, assemble complex layouts and...

---

<div class="post-metadata">

### Author: ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)
#### Post date: [August 26, 2024, 11:56pm UTC](https://discourse.julialang.org/t/subscript-in-label/118620/4 "2024-08-26T23:56:31Z")

</div>

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.:

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

```

gives something like

 ![richtextmakie](https://global.discourse-cdn.com/julialang/original/3X/2/7/277a5c3462dc352dc48e060c4055b526d4f3fd65.png)
