AlgebraOfGraphics.jl icon indicating copy to clipboard operation
AlgebraOfGraphics.jl copied to clipboard

AoG doesn't respect the `levels` of a categorical vector when transformation is applied

Open pdeffebach opened this issue 1 year ago • 1 comments

Here's an MWE

julia> using CategoricalArrays; 

julia> d = DataFrame(x = ["z", "a", "b"], v = [1, 2, 3]);

julia> d.x = categorical(d.x, ; levels = d.x);

julia> data(d) * mapping(:x, :v) * visual(BarPlot) |> draw

julia> # So far so good!

julia> d_labs = Dict("z" => "Z", "a" => "A", "b" => "B");

julia> data(d) * mapping(:x => (t -> d_labs[t]), :v) * visual(BarPlot) |> draw

It would be great is I could apply the transformation but then alzo have the "z" row go first.

pdeffebach avatar Mar 01 '24 19:03 pdeffebach