# Subplot enumeration for papers with Makie.jl

**URL:** <https://discourse.julialang.org/t/subplot-enumeration-for-papers-with-makie-jl/61685>\
**Category:** Visualization\
**Tags:** question, makie\
**Created:** [May 23, 2021, 4:38pm UTC](https://discourse.julialang.org/t/subplot-enumeration-for-papers-with-makie-jl/61685 "2021-05-23T16:38:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [May 23, 2021, 4:38pm UTC](https://discourse.julialang.org/t/subplot-enumeration-for-papers-with-makie-jl/61685/1 "2021-05-23T16:38:37Z")

</div>

Hi there, I have a figure like this:

 ![fractaldim_noise](https://global.discourse-cdn.com/julialang/original/3X/c/6/c6857bc59f12755aff052a61f72267226c54b57b.png)

made with PyPlot. The contents of the figure do not matter, only the letters that are in the upper right corner of each axis. Such “enumeration” is critical for publication quality figures, but I am not sure how to achieve it with Makie.jl in an “automated way”. With PyPlot.jl I can actually do something simple:

```julia
"`add_identifiers!(fig = gcf(), axs = fig.get_axes(); xloc = 0.985, yloc = 0.975)`"
function add_identifiers!(fig = gcf(), axs = fig.get_axes(); xloc = 0.975, yloc = 1)
    bbox = Dict(:boxstyle => "round,pad=0.3", :facecolor=>"white", :alpha => 1.0)
    for (i, ax) in enumerate(axs)
        l = collect('a':'z')[i]
        try
            ax.text(xloc, yloc, "$(l)"; transform = ax.transAxes,
            bbox = bbox, zorder = 99, va = "top")
        catch err
            @warn err
        end
    end
end

```

So after I Have created a figure with multiple subplots, I simply call `add_identifiers!(fig)` and it just works automatically and nicely puts the identifier letter on the top-right of the axis no matter how large the axis is, or where it is.

How to do this in Makie.jl?

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [May 23, 2021, 6:21pm UTC](https://discourse.julialang.org/t/subplot-enumeration-for-papers-with-makie-jl/61685/2 "2021-05-23T18:21:20Z")

</div>

I think you are looking for `Label`, as in:

```julia
julia> fig = Figure();

julia> ax1 = Axis(fig[1, 1]);

julia> lines!(ax1, 0..10, sin);

julia> Label(fig[1, 1, TopRight()], "(a)");

julia> ax2 = Axis(fig[2, 1]);

julia> lines!(ax2, 0..10, cos);

julia> Label(fig[2, 1, TopRight()], "(b)");

julia> fig

```

 ![labels](https://global.discourse-cdn.com/julialang/original/3X/0/b/0bd306ac5de64d2d0c0c0edcffa3771e7558637e.png)

(Not sure if there is anything more specific for paper figures, but `Label` allows a fair amount of customization, so you should be able to tweak it…)

EDIT: here are the docs for [Label](https://makie.juliaplots.org/dev/makielayout/label.html). I’ve just realized I’m not using the default theme, but you can tweak the font of the label to make it look more “label like”, for example this one is Fira Sans with medium weight.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [May 23, 2021, 7:45pm UTC](https://discourse.julialang.org/t/subplot-enumeration-for-papers-with-makie-jl/61685/3 "2021-05-23T19:45:22Z")

</div>

The thing is, I really like the current design I have, where there is this nice box around the label. I will be putting it ontop of the axis splines, so this box is necessary to make the label distinct. I’d also like to automatically do the axis enumeration, also not sure how to loop over axis of a figure without explicitly collecting them like you did above with `ax1` and `ax2`.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [February 2, 2022, 5:20pm UTC](https://discourse.julialang.org/t/subplot-enumeration-for-papers-with-makie-jl/61685/4 "2022-02-02T17:20:02Z")

</div>

The solution so far is to use `Label` in the same location as the Axis.

Something like:

```julia
    GLMakie.Label(fig[i, 1], labels[i]; 
        tellwidth=false, tellheight=false,
        valign = :top, halign = :right, padding = (0, 5, 5, 0),
    )

```

This requires one to know beforehand to which figure location each axis corresponds to. I’m now trying to figure out how to exact this information from an `Axis` instance.
