Skip to content

Color by qualitative variable #465

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

Closed
bhogan-mitre opened this issue May 8, 2018 · 3 comments
Closed

Color by qualitative variable #465

bhogan-mitre opened this issue May 8, 2018 · 3 comments

Comments

@bhogan-mitre
Copy link
Contributor

bhogan-mitre commented May 8, 2018

It would be nice to be able to color by a qualitative variable. For example, in the dev app scatter plot when selecting color by months, the points change from default blue to black (all taking the same color).

It seems this may be a limitation in the underlying plotly.js. But the user isn't going to know that as they are presented an option to color by that field.

I'm not sure the best way to approach this. Is it dependent on the 'split by' transform being plugged in? Or is there a way to map that qualitative variable to a numeric index behind the scenes? The latter seems easier for the user, but it may be challenging/impossible to get a legend to communicate what the colors correspond to in that case.

@nicolaskruchten
Copy link
Contributor

Right now the only way to do this is with the groupby/splitby transform, but I'd love for plotly.js to get builtin support for just color-by-category. It wouldn't be hard to get basic support for it: just map categories to numbers and reuse the existing colorbar system but the complexities of configuration will add up quickly: how to control the order of the colors, the specific mapping of color to category, the difference between colorbar and legend behaviour etc. The groupby transform is clunkier to use initially but gives essentially all of this control, which is nice.

@bhogan-mitre
Copy link
Contributor Author

Great, thanks for the info!

@nicolaskruchten
Copy link
Contributor

We'll be taking this up in plotly/plotly.js#1747 and once done there we'll add support here... Closing for now.

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

2 participants