Makie: categorical x variables

Hi,

I recently moved from Plots to Makie and I am trying to make a box plot where each box aggregates data w.r.t. a real variable x.
However the three categories are not evenly spaced. You can see a MWE here which produces a pretty ugly plot.

julia> data = (y = rand(90), x = [fill(80,30); fill(320,30);  fill(1280,30)]);

julia> boxplot(data.x, data.y)

In Plots, I used to convert the x variables to strings so that it would treat them as categories.

julia> boxplot(string.(data.x), data.y)

This does not work in Makie. I checked the roadmap for Makie and nothing concerning such a problem seems to be planned. So I’m guessing there’s already a solution that I don’t know about.
Could anybody tell me how to get three evenly spaced boxes of the same width ?
I know that I could convert the x variables to 1 2 and 3 but 1) that’s annoying to do and 2) it would not give the correct x labels on this axis.

1 Like

In makie, now you only need to take care of the ticks positions. See this example with a lot of options to customise your plot:

2 Likes

Okay so it seems that the way to go is to do multiple boxplot! calls instead of a single one.

Thanks for the example (and the other ones, I hope you’ll find the time to finish the 100 days of plotting :slight_smile:)