Groupedbar x axis order
In Groupedbar we can change the order withing groups by making them a categorical variable and changing the levels. It's a little circumspect, but it works. But we can't do that with the order of the groups (specified by x). That would be great to have.
Related, always from the discourse thread:
we could probably allow to use
groupedbar(["a", "a", "b", "b"], [1,2,3,4])to give the same plot asgroupedbar(["a", "b"], [1 2; 3 4]), currently it errors.
@mkborregaard Do you have an example of using categorical variables to reorder within groups? I tried using CategoricalArrays.jl, but this doesn't seem to be working.
Also to follow up for those who are struggling with the same issue, I have found that using replace! to add a series of spaces before words you want to appear first works as a brutal hack. I think Plots.jl actually trims the white space before displaying it in the plot, but internally for ordering, the spaces are respected by <, >, etc.
Works if you don't have many issues with the lexical order, but a pain otherwise.
Any luck with this? (or any working workaround? the space thing does not work (spaces are preserved in the legend)
Yeah spaces trick only worked when plotting in IJulia, but spaces were preserved when saving to file. I have not found any other work around.
I gather no updates on this?
An option which makes the plot command respect the dataframe order for x would be really nice, as that would simply allow !sort (or any other method) to arrange the dataframe in the desired order for plotting instead of the alphabetical x sort that occurs now.