I have a stacked bar plot, and can add a label to each block in the stack with bar_labels=:y
. But this is noisy, and I’d like to only add a single label to the top of the stack, showing the total stacked value. How do I do that?
(here’s an example, borrowed from Bar Label Alignment · Issue #3160 · MakieOrg/Makie.jl · GitHub)
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,
bar_labels = :y,
axis = (xticks = (1:3, ["left", "middle", "right"]),),
)
I’d like it to show only the labels at the top of each bar, ie “0.6”, “1.5” and “2.4”
thanks!