How to place legend for stacked bar chart inside an axis. This can save lot of space on plots.- How to place labels when drawing stacked bar chart
Sample code can be found in makie examples here
using CairoMakie
tbl = (x = [1, 1, 1, 2, 2, 2, 3, 3, 3],
height = 0.1:0.1:0.9,
grp = [1, 2, 3, 1, 2, 3, 1, 2, 3],
grp1 = [1, 2, 2, 1, 1, 2, 1, 1, 2],
grp2 = [1, 1, 2, 1, 2, 1, 1, 2, 1]
)
barplot(tbl.x, tbl.height,
stack = tbl.grp,
color = tbl.grp,
axis = (xticks = (1:3, ["left", "middle", "right"]),
title = "Stacked bars"),
)