0

考虑以下人为设计的示例:

{
  "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图例将包含许多元素,并且比绘图本身大得多。

有没有办法在多列而不是一个列中显示这个图例?

4

1 回答 1

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"}
  }
}
于 2017-02-04T05:38:00.913 回答