Makie Bar Plots

I feel as though I’m probably missing something obvious, but there don’t seem to be a lot of examples for bar plots in Makie that don’t point you back towards AoG. How can I get these bars to be properly dodged? Here is the code I wrote, and included is an example result. I just want one data set on the left and the other on the right. Nothing fancy. Any help is greatyly appreciated.

grades = df[:,1]
fig = CairoMakie.Figure()
ax1 = CairoMakie.Axis(fig[1,1], xticks = (1:7, grades), title = "Pore and Particle Size")

barplot!(ax1, 1:7,
particles,
dodge = [1,1,1,1,1,1,1], width = 0.5,
)

barplot!(ax1, 1:7,
pores,
dodge = [2,2,2,2,2,2,2], width = 0.5,
)

using CairoMakie

grades    = ["ZXF-5Q", "ACF-10Q", "AXF-3Q", "AXF-5Q", "AXM-5Q", "AXZ-5Q", "TM"]
particles = [1.0, 4.9, 4.9, 4.9, 4.9, 4.9, 1.0]
pores     = [0.3, 0.8, 0.8, 0.8, 0.8, 0.7, 1.5]

fig = Figure()
ax1 = Axis(
    fig[1, 1],
    xticks = (1:7, grades),
    title = "Pore and Particle Size",
)

# 7 positions, 2 bars per position
x      = repeat(1:7, inner = 2)          # Int vector, length 14
y      = vcat(particles, pores)          # Float vector, length 14
dodge  = repeat([1, 2], 7)               # group ids, length 14
colors = repeat([:steelblue, :goldenrod], 7)

barplot!(ax1, x, y; dodge = dodge, color = colors, width = 0.8)

fig

will give you what you’re looking for.

A minimum working example would help elucidate how to get from the example to the proposed solution.

You need to set ndodge if the dodge vectors don’t all contain the largest index, because that’s what’s used by default. Barplot 1 sees a dodge group with ndodge=1 which is no dodge. Barplot 2 sees 2 as the highest value so that one’s dodged correctly. AoG sets this stuff based on the categorical scale it determines globally.

Thank you kindly.