Multi-group legends

using MakieLayout
using AbstractPlotting: px

using AbstractPlotting

scene, layout = layoutscene(resolution = (1400, 900))

ax = layout[1, 1] = LAxis(scene)

markersizes = [5, 10, 15, 20]
colors = [:red, :green, :blue, :orange]

for ms in markersizes, color in colors
    scatter!(ax, randn(5, 2), markersize = ms * px, color = color)
end

group_size = [MarkerElement(marker = :circle, color = :black, strokecolor = :transparent,
    markersize = ms * px) for ms in markersizes]

group_color = [PolyElement(color = color, strokecolor = :transparent)
    for color in colors]

legends = [LLegend(scene,
    [group_size, group_color],
    [string.(markersizes), string.(colors)],
    ["Size", "Color"]) for _ in 1:6]

layout[1, 2:4] = legends[1:3]
layout[2:4, 1] = legends[4:6]

for l in legends[4:6]
    l.orientation = :horizontal
    l.height = Auto()
    l.tellheight = true
    l.width = Auto()
    l.tellwidth = false
end

legends[2].titleposition = :left
legends[5].titleposition = :left

legends[3].nbanks = 2
legends[5].nbanks = 2
legends[6].nbanks = 2

scene