# Makie Uneven Legend Banks

**URL:** <https://discourse.julialang.org/t/makie-uneven-legend-banks/121757>\
**Category:** Tooling\
**Tags:** makie, cairomakie\
**Created:** [October 25, 2024, 6:38pm UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757 "2024-10-25T18:38:49Z")\
**Posts on this page:** 7\
**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:** [October 25, 2024, 6:38pm UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/1 "2024-10-25T18:38:49Z")

</div>

Hello,

Is it possible to have uneven number of elements in the banks of a Legend in Makie? Below is an MWE - the actual figure I need this for is crowded and I basically need two legend entries in bank 2 moved into bank 1.

Is that possible? Any ideas on how that could be specified?

In the MWE, how can I have legend entries for plots 1 to 4 in bank 1 and 5 to 6 in bank 2.

```julia
begin
    x = LinRange(0, 1, 100)
    y = x .^ 2
    fig = Figure()
    ax = Axis(fig[1, 1])
    for i = 1:6
        lines!(x, i .* y, label="plot $(i)")
    end
    axislegend(position=:lt, nbanks=2, framevisible=false)
    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:** [October 26, 2024, 7:56am UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/2 "2024-10-26T07:56:37Z")

</div>

Maybe like this?

```julia
begin
    x = LinRange(0, 1, 100)
    y = x .^ 2
    fig = Figure()
    ax = Axis(fig[1, 1])
    for i = 1:6
        lines!(x, i .* y, label="plot $(i)")
    end
    axislegend(position=:lt, nbanks=4, framevisible=false, orientation = :horizontal)
    fig
end

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/e/ee754a34eca24b8327cfbfb208cc3c2dcc28b5d5.jpeg)

Otherwise one could probably work with empty entries to shape the legend into more custom configurations

---

<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:** [October 26, 2024, 9:43pm UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/3 "2024-10-26T21:43:20Z")

</div>

> [@jules](#):
>
> Otherwise one could probably work with empty entries to shape the legend into more custom configurations

Do you have any examples handy of how this could be done?

Edit: Also, was just thinking. One way to accomplish this would be to allow users to specify number of entries per bank.

---

<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:** [October 27, 2024, 7:30am UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/4 "2024-10-27T07:30:41Z")

</div>

Like this:

```julia
begin
    x = LinRange(0, 1, 100)
    y = x .^ 2
    fig = Figure()
    ax = Axis(fig[1, 1])
    lins = map(1:6) do i
        lines!(x, i .* y)
    end
    plts = [lins[1:3]..., [], [], lins[4:6]...]
    labels = ["A", "B", "C", "", "", "D", "E", "F"]
    axislegend(ax, plts, labels; position=:lt, nbanks=2, framevisible=false)
    fig
end

```

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

---

<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:** [October 27, 2024, 11:32pm UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/5 "2024-10-27T23:32:43Z")

</div>

Thanks! Although now there are blanks. I was hoping they would be “skipped” so it would look something like this, and pretending that `D` is also excluded. (excuse the amateur paint skills 😅) Hopefully that makes sense. Let me know if not and I will try to be clearer.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/1/1121bc39917476bbf98e3719351fa7064c6a3260.png)

---

<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:** [October 28, 2024, 4:48am UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/6 "2024-10-28T04:48:13Z")

</div>

The blanks were just for demonstration, but you can do any arrangement with that no?

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 29, 2024, 6:22am UTC](https://discourse.julialang.org/t/makie-uneven-legend-banks/121757/7 "2024-10-29T06:22:59Z")

</div>

To get that, just add a single blank to the end.
