Grouping in Julia plots

Why not just write a little helper function? That way you can call it at the function call.

function combine_cases(x)
    combined_cases = map(df.cases) do c
        if c in ["A", "B"]
            "A or B"
        elseif c in ["C", "D"]
            "C or D"
        else
            c
        end
    end
end

plot(df.x, df.y, group = combined_cases(df.cases))
1 Like