AoG Barplot: How to match color of a single bar to theme?

hendri54
Thu, 13 Jul 2023 18:47:19 +0000
General Usage

When I generate grouped barplots in AoG, the colors of the bars are determined by the theme. However, barplots with a single group produce grey bars.
How can I set the bar colors to match the theme?

MWE:

using AlgebraOfGraphics, CairoMakie

df = DataFrame(x = [1,2,3], y = [1,2,3] .* 0.9, z = ["1", "2", "1"]);
set_aog_theme!();
plt1 = data(df) * mapping(:x, :y) * visual(BarPlot);
fig1 = draw(plt1)
plt2 = data(df) * mapping(:x, :y; color = :z) * visual(BarPlot);
fig2 = draw(plt2)

Output for fig1:

Output for fig2:

5 posts - 2 participants