# Makie Layout Text Over Column of Plots

**URL:** <https://discourse.julialang.org/t/makie-layout-text-over-column-of-plots/113509>\
**Category:** Visualization\
**Tags:** makie, cairomakie\
**Created:** [April 25, 2024, 3:35pm UTC](https://discourse.julialang.org/t/makie-layout-text-over-column-of-plots/113509 "2024-04-25T15:35:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TI36XPro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ti36xpro/32/33658_2.png) [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Post date:** [April 25, 2024, 3:35pm UTC](https://discourse.julialang.org/t/makie-layout-text-over-column-of-plots/113509/1 "2024-04-25T15:35:52Z")

</div>

Hello,

I am trying to show the evolution of a quantity via a series of plots. I have three simulations which describe something changing with time. I want to show side by side comparisons at various times. So my idea is to create a series of panes where each column corresponds to a different simulation and each row corresponds to a different time.

I’d like to place an overall label to each column in addition to each plot pane having a title. I was able to achieve this using newlines and the `Label` as shown below. It does seem a little hacky but I’m not sure how else to explicitly place `Label` inside a grid layout.

```julia
# mwe.jl
using CairoMakie

begin
    fig = Figure()
    gL = GridLayout(fig[1, 1], 3, 2)
    width = 100
    height = 100
    make_ax = (pane, title) -> Axis(pane, width=width, height=height, title=title)

    ax1 = make_ax(gL[1, 1], "Plot 1")
    ax2 = make_ax(gL[2, 1], "Plot 2")
    ax3 = make_ax(gL[3, 1], "Plot 3")
    ax4 = make_ax(gL[1, 2], "Plot 4")
    ax5 = make_ax(gL[2, 2], "Plot 5")
    ax6 = make_ax(gL[3, 2], "Plot 6")

    mynum = 5

    Box(gL[1:3, 1], color=(:white, 0.0), strokewidth=1.5, cornerradius=5, width=width * 1.5, height=4.5 * height)
    Label(gL[1, 1, Top()], "Column Title = $(mynum)\n\n\n")

    resize_to_layout!(fig)
    fig
end

```

The problem I am having is that I need to be able to use LaTeXStrings in the `Label` text and that does not appear to work when I try to concatenate a LaTeXstring with newlines. Apparently it has worked for some folks as described [here](https://discourse.julialang.org/t/add-newline-to-latexstring-equation/95104/9) but it is not working for me. See below.

Using `Label(gL[1, 1, Top()], [L"Column Title = $\alpha=%$(mynum)$" * "\n\n\n"])` I get

![image](https://global.discourse-cdn.com/julialang/original/3X/0/4/0432ca6165f8cc1a8ca6e2177c4c9f358d1b3694.png)

And if I don’t use any newlines then I get text overlaid.

![image](https://global.discourse-cdn.com/julialang/original/3X/c/f/cf68fa919f562c21c414b7b298e5790fc78926d4.png)

I also tried using `text!` but I don’t know how to place it outside the existing axes. See example below. It is “stuck” inside the `Axis`. It does correctly display the latex so this seems close to what I want - if only I could place it outside the axis.

Any suggestions would be appreciated.

![image](https://global.discourse-cdn.com/julialang/original/3X/7/d/7d57216795d02c63ffa66b6849b3415ef3f5f045.png)

```julia
using CairoMakie

begin
    fig = Figure()
    gL = GridLayout(fig[1, 1], 3, 2)
    width = 100
    height = 100
    make_ax = (pane, title) -> Axis(pane, width=width, height=height, title=title)

    ax1 = make_ax(gL[1, 1], "Plot 1")
    lines!(1:10, 1:10)
    ax2 = make_ax(gL[2, 1], "Plot 2")
    ax3 = make_ax(gL[3, 1], "Plot 3")
    ax4 = make_ax(gL[1, 2], "Plot 4")
    ax5 = make_ax(gL[2, 2], "Plot 5")
    ax6 = make_ax(gL[3, 2], "Plot 6")

    mynum = 5

    Box(gL[1:3, 1], color=(:white, 0.0), strokewidth=1.5, cornerradius=5, width=width * 1.5, height=4.5 * height)
    text!(ax1, 5, 10, align=(:center, :center), text=L"Column Title, $\alpha=%$(mynum)$")

    resize_to_layout!(fig)
    fig
end

```

---

<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 25, 2024, 4:36pm UTC](https://discourse.julialang.org/t/makie-layout-text-over-column-of-plots/113509/2 "2024-04-25T16:36:34Z")

</div>

It sounds like you’d be fine just placing the labels at row 0, then you don’t have to fiddle with linebreaks etc. Just make sure to set `tellwidth = false` so the columns don’t shrink to the text size. So like `Label(gl[0, 1], "Column title ...", tellwidth = false)`

---

<div class="post-metadata">

**Author:** ![TI36XPro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ti36xpro/32/33658_2.png) [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Post date:** [April 25, 2024, 4:37pm UTC](https://discourse.julialang.org/t/makie-layout-text-over-column-of-plots/113509/3 "2024-04-25T16:37:27Z")

</div>

Thank you! 🙂
