# Colorbar title placement in makie

**URL:** <https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602>\
**Category:** General Usage\
**Tags:** makie\
**Created:** [April 7, 2026, 10:28am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602 "2026-04-07T10:28:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tduretz](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Post date:** [April 7, 2026, 10:28am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/1 "2026-04-07T10:28:46Z")

</div>

I’m trying to make a figure which features a horizontal colorbar. I would like the title of the colorbar to be placed directly to the right of the colorbar, instead of above/below.  
I’ve seen this [post](https://discourse.julialang.org/t/move-label-on-top-of-the-colorbar-using-makie/123813) but using this messed up the layout of the rest of the figure.

Is that possible? Or is there a simple fix that does not affect the curent layout?

---

<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 7, 2026, 10:31am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/2 "2026-04-07T10:31:17Z")

</div>

How did it mess up the layout of the rest of the figure?

You could alternatively try `halign = :left, width = 0`. I’m not 100% sure but I’d predict that this leaves the label location as is, but doesn’t affect the layout because the element now looks like it doesn’t have any width.

---

<div class="post-metadata">

**Author:** ![tduretz](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Post date:** [April 7, 2026, 10:37am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/3 "2026-04-07T10:37:17Z")

</div>

So the figure has 3 columns and the colorbar is created this way:

```julia
    cb = Colorbar(f[2, 1:3], hm, label="Label", width = 300, labelsize = ftsz, ticklabelsize = ftsz, vertical=false, valign=true, flipaxis = true )

```

To mimic what was done in the post, I tried:

```julia
    Label(f[2, 4, Right()], "Label")

```

but this created a 4th column which squeezed the above/below rows.

---

<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 7, 2026, 10:40am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/4 "2026-04-07T10:40:58Z")

</div>

Ah, the `Right` side should be in the same column where your colorbar is. So `f[2, 3, Right()]`. Otherwise you add a new full column, as you’ve noted. `Right` refers to the protrusion or gap space on the right side of that layout column.

---

<div class="post-metadata">

**Author:** ![tduretz](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Post date:** [April 7, 2026, 10:54am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/5 "2026-04-07T10:54:15Z")

</div>

Ah nice, thank you!  
What is the best strategy to reduce the space between the colorbar and the label ?  
It’s currently very much to the right.

---

<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 7, 2026, 11:17am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/6 "2026-04-07T11:17:17Z")

</div>

It’s easier if you give example code with an image, I don’t know what “very much to the right” looks like 🙂

---

<div class="post-metadata">

**Author:** ![tduretz](https://avatars.discourse-cdn.com/v4/letter/t/bcef8e/32.png) [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Post date:** [April 7, 2026, 11:23am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/7 "2026-04-07T11:23:29Z")

</div>

This is basically what ` Label(f[2, 3, Right()], "label", halign = :left)` did:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/a/2a3310de333920e4f6ed1868276d26f0f0df30e3.png)  
Now the aim would be to get `label` adjacent to the colorbar without disturbing the position of the three above panels.

---

<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 7, 2026, 11:29am UTC](https://discourse.julialang.org/t/colorbar-title-placement-in-makie/136602/8 "2026-04-07T11:29:55Z")

</div>

Ah, ok I see, the problem is that the colorbar spans across three columns but only uses part of that width. The protrusion space starts at the actual end of column 3 though, so there’s a gap.

Use a nested gridlayout at the position where the colorbar is now, then put the colorbar at [1, 1] in that layout and the label at [1, 1, Right()]. The column width of that inner layout will shrink to the colorbar’s width, making the label correctly positioned while still leaving the colorbar centered. If you put the label in column 2 of the nested layout, the colorbar would not be centered anymore.
