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

More concise way to do categorical colors #4486

Open
jariji opened this issue Oct 15, 2024 · 0 comments
Open

More concise way to do categorical colors #4486

jariji opened this issue Oct 15, 2024 · 0 comments
Labels
Attributes Plot, Block and Scene Attributes colors color, colormap, colorrange, alpha, etc enhancement Feature requests and enhancements

Comments

@jariji
Copy link
Contributor

jariji commented Oct 15, 2024

let n = 50,  x = randn(n), y = randn(n), c = rand((:a,:b,:c), n)
    scatter(x, y, color=Makie.wong_colors()[indexin(c, unique(c))])
end

This code makes a scatter plot where the color of each point depends on its categorical value c. It works, but I'd like a shorter way to write this, such as color=Categorical(c) or color=Cycled.(indexin(c, unique(c))).

Image

@jariji jariji added the enhancement Feature requests and enhancements label Oct 15, 2024
@ffreyer ffreyer added Attributes Plot, Block and Scene Attributes colors color, colormap, colorrange, alpha, etc labels Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attributes Plot, Block and Scene Attributes colors color, colormap, colorrange, alpha, etc enhancement Feature requests and enhancements
Projects
None yet
Development

No branches or pull requests

2 participants