Vertical band plot in makie

In makie, we can create a band plot between two arrays y_lower and y_upper, for a single x array.

Would there be a way to use two x arrays and one y array instead, and produce something that looks more like a violin plot?

The answer from this thread (How to exchange x and y axis in band plot) seems to still work. That is to say, since it’s not marked as the solution,

1 Like

Perfect, that does the job!
Somehow I missed it when I was looking for relevant posts.

While we’re at it :

lines!(x, y , colormap=:viridis, colorrange=(1, 10), color=5)

works perfectly well, but

band!(x, y1,y2 , colormap=:viridis, colorrange=(1, 10), color=5)

throws the following:

TypeError: in typeassert, expected ColorTypes.RGBA{Float32}, got a value of type Float32

Is there something I’m missing here, or is it a bug?

Looks like a bug to me, file an issue?

1 Like

Done :white_check_mark:

Sorry to bring this up again, but would there be a way to achieve this

before the bug is fixed?

Like, maybe we could convert the information in colormap=:viridis, colorrange=(1, 10), color=5 into an RGBA object or equivalent?

Bit roundabout but this is one option

only(Makie.numbers_to_colors([5], Makie.to_colormap(:plasma), identity, Vec2(1, 10), Makie.automatic, Makie.automatic, RGBAf(0, 0, 0, 0)))

For some reason just passing 5 doesn’t work for me even though it should

1 Like

Does the job, thanks a lot!