I tried to create a dodged stripped barplot where bars from each plot have different strip directions.
After consulting the documentation about dodged bars and stripped bars, I came up with the following short example:
using CairoMakie
cats = repeat(Float64[1, 2], inner=2)
heights = repeat(Float64[1, 2], outer=2)
group = repeat([1, 2], outer=2)
directions = [[1.0, 1.0], [-1.0, 1.0]]
patterns = Any[Makie.LinePattern(background_color=(:red, 0.5), direction=direction) for direction in directions]
fig = Figure()
barplot(fig[1, 1], cats, heights, dodge=group, color=patterns[group])
fig
However, I got the following error message:
ERROR: MethodError: Cannot `convert` an object of type Makie.LinePattern to an object of type Float32
The individual line patterns seem to be valid, as the following code that uses just one line pattern for every bar works fine:
fig2 = Figure()
barplot(fig2[1, 1], cats, heights, dodge=group, color=patterns[1])
fig2
I wonder where my code went wrong. Thank you very much for the help!