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

Different colors #26

Closed
SSebigo opened this issue Nov 22, 2021 · 5 comments
Closed

Different colors #26

SSebigo opened this issue Nov 22, 2021 · 5 comments

Comments

@SSebigo
Copy link

SSebigo commented Nov 22, 2021

For a rectangle interval chart, what is the idiomatic way to have different colors for bars?

For example, I have 5 bars and one should have a different color from the others, how to achieve that?

@entronad
Copy link
Owner

This example is in polar coordinate, but rectangle bars are just the same.

@SSebigo
Copy link
Author

SSebigo commented Nov 22, 2021

@entronad How does it use a String as an index for the colors list? (Sorry if it's a mistake)

@entronad
Copy link
Owner

There are two steps, the String variables are converted to index ints by Scale, and the index mapped to the colors list.
There is a detailed and full introduction:
https://medium.com/@entronad/the-versatility-of-the-grammar-of-graphics-d1366760424d

@SSebigo
Copy link
Author

SSebigo commented Nov 22, 2021

@entronad Is it possible a value that should never be displayed onscreen? So far from what I see the value used to index the color has to be "registered" inside Chart.variables, the problem being that those values are displayed in the tooltip.

@SSebigo
Copy link
Author

SSebigo commented Nov 22, 2021

Nevermind, found out how to do it. Thx.

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