Below I have a vega chart that doesn't render because I am trying to make one of the grouped categories, US Gross, to be encoded as "category10" instead of assigning it one specific color. Any thoughts on whether or not this is possible in Vega?
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"url": "data/movies.json"},
"repeat": {"layer": ["Worldwide Gross", "US Gross"]},
"spec": {
"mark": "bar",
"encoding": {
"x": {"field": "Major Genre", "type": "nominal"},
"y": {
"aggregate": "sum",
"field": {"repeat": "layer"},
"type": "quantitative",
"title": "Total Gross"
},
"color": {
"datum": {"repeat": "layer"},
"title": "Gross",
"scale": {"range": ["#2a9d8f", {"scheme": "category20"}]}
},
"xOffset": {"datum": {"repeat": "layer"}}
}
},
"config": {"mark": {"invalid": null}}
}```
A verson of the code can be found [here] which represents a verson where I've set US Gross to teal, but ideally it'd be category 10 so that each value for US Gross across the x-axis is different[1]
[1]: https://vega.github.io/editor/#/url/vega-lite/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykBaADZ04JAKyUAVhDYA7EABoQAEySYUqUAwBOgtCrVICCNsRpwIUmfIC+S7XBxw1aUIKQBPONrQBtEADqbLrKAO40ynAABADi2mwQEIogAKoAyrHxiSAAunYgEE5QriDI2gDW+kxIPkpwslBsyjSyZCUAHiUAZuaCyvoAskiSwbH1DsmYHk76smwILUh6+R4lSGRkDhSYcPoQDAjJPXB9JQ5OLujuXj75UzPoAI4MSLKYdGo0pJN0grvoABU2OpBJkEkl8o1BMESqpMAczo5nJh9NdvCA7r9-iA4uDktAlv9QNpXmR-v4AMQAJiQAE5lAAOLqTZx6PL5doAeS6XQgcBRmgM8MOgvOyNRnnRNmlkLkPTagrKlUFLWISwiaFkDEEghlQA
Option 1: Hard-coded colors:
Option 2: Color scheme (I used category20 since we have more than 10 colors) https://vega.github.io/vega/docs/schemes/
Option 3: Color based on a sequential gradient: