如何在 VegaLite 中隐藏大小的图例并按区域规范化大小?

How to hide legend for the size and normalise size by area in VegaLite?

尺码图例显示在右侧,如何完全隐藏?

第二个问题 - 圆的直径似乎与给定的数字成正比。我怎样才能以另一种方式缩放它,以便:

live playground.

要完全隐藏图例,请在相关编码中使用 "legend": null(请参阅 Legend docs)。

要控制尺寸范围,您可以使用 scale.range 设置。例如,"scale": {"range":[0, 50]},将使点的大小在 0 到 50 像素之间变化(参见 Scale.range docs)。

这是在您的示例图表 (vega editor) 中使用的示例:

{
  "data": {
    "values": [
      {"a": "C", "b": 2},
      {"a": "C", "b": 7},
      {"a": "C", "b": 4},
      {"a": "D", "b": 1},
      {"a": "D", "b": 2},
      {"a": "D", "b": 2.1},
      {"a": "D", "b": 2.3},
      {"a": "D", "b": 6},
      {"a": "E", "b": 8.1},
      {"a": "E", "b": 4},
      {"a": "E", "b": 7}
    ]
  },
  "encoding": {
    "size": {
      "field": "b",
      "type": "quantitative",
      "scale": {"range": [0, 50]},
      "legend": null
    },
    "x": {"axis": {"title": null}, "field": "b", "type": "quantitative"},
    "y": {"axis": {"title": null}, "field": "a", "type": "nominal"}
  },
  "mark": "circle"
}