I am trying to plot boxplots of values with respect to 4 categories represented as numbers. The four categories are powers of two: 16384, 32768, 65536, 131072.
Let’s use this MWE dataframe:
using DataFrames, StatsPlots df= DataFrame(cat = [16384, 32768, 65536, 131072, 16384, 32768, 65536, 131072, 16384, 32768, 65536, 131072], val = rand(12))
There are two possibilities, first I can plot without any change
But as you can see on this image the boxes are not evenly spaced but the categories are numbers
But if I transform into strings I get nice boxes, but then the values are sorted alphabetically and not numerically.
I can’t find a way to make order this correctly. Anyone knows ?