Makie add manual legend

I have a plot such as barplot(1:3, 2:4, color = [:red, :blue, :red]) and would like to add a legend such that the red => "A" and blue => "B", how could I accomplish that?

If you have array-valued colors you currently have to build legends manually, unfortunately.

f, ax, bp = barplot(1:3, 2:4, color = [:red, :blue, :red])
Legend(f[1, 2], [PolyElement(color = :red), PolyElement(color = :blue)], ["A", "B"])
f

1 Like