Skip to content

Consistent colours for bar charts #2302

Closed Answered by mbostock
sbarre asked this question in Q&A
Discussion options

You must be logged in to vote

I think Fil inadvertently gave you the wrong syntax. Pretty sure this is covered in the docs, but try this instead:

const color = Plot.scale({color:  {domain: ["A", "B", "C"]}});
Plot.barX().plot({color});

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mbostock
Comment options

Answer selected by sbarre
@Fil
Comment options

Fil Mar 21, 2025
Collaborator

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants