考虑以下设想的例子:
{
"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"}
}
}
数据集有Miles_per_Gallon
的许多值,因此color
图例将包含许多元素,并且会比图本身大得多。
有没有办法在多个列中显示此图例,而不是单个列?
答案 0 :(得分:1)
您可以使用每加仑英里数作为定量变量。
{
"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"}
}
}