Reputation: 8279
Consider the following contrived example:
{
"data": {"url": "data/cars.json"},
"mark": "point",
"encoding": {
"x": {"field": "Horsepower","type": "quantitative"},
"y": {"field": "Origin","type": "nominal"},
"color": {"field": "Miles_per_Gallon","type": "ordinal"}
}
}
The dataset has many values for Miles_per_Gallon
so the color
legend will have many elements and will be considerably larger than the plot itself.
Is there a way to show this legend in multiple columns, rather than a single one?
Upvotes: 0
Views: 315
Reputation: 5935
You can use the Miles per Gallon as a quantitative variable.
{
"data": {"url": "data/cars.json"},
"mark": "point",
"encoding": {
"x": {"field": "Horsepower","type": "quantitative"},
"y": {"field": "Origin","type": "nominal"},
"color": {"field": "Miles_per_Gallon","type": "quantitative"}
}
}
Upvotes: 1