Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the color = dims(1) correspond to the mapping for wide data #474

Open
pdeffebach opened this issue Oct 17, 2023 · 1 comment
Open

Comments

@pdeffebach
Copy link

Problem description

I am making a line plot with wide data. The command is

p = data(df_collapsed) * mapping(:mean_age, [:N, :U, :B, :W], color = dims(1) => renamer(["N", "U", "B", "W"])) * visual(Lines)

See how I have to repeat ["N", "U", "B", "W"] twice? I should just have to write dims(1) and have it automatically take the name of the lines from the mapping.

@pdeffebach
Copy link
Author

Here is an MWE

julia> using AlgebraOfGraphics, GLMakie, DataFrames;

julia> df = DataFrame(x = 1:10, y1 = rand(10) .+ 1, y2 = rand(10) .+ 2);

julia> p = data(df) * mapping(:x, [:y1, :y2], color = dims(1)) * linear();

julia> draw(p)

Which gives

image

I would like the two lines on the graph to be labelled "y1" and "y2" rather than CartesianIndex as is the current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant