小编Nat*_*ins的帖子

在 Altair 3.0 中启用自动工具提示

我注意到Vega-Lite 3.0.0 发行说明中提到“默认包含工具提示”,这适用于 Altair 3.0 中的箱线图,但不适用于直方图等其他图。

当我在 Vega Editor 中打开我的 Altair 图时,我会看到图表定义顶部"mark": {"tooltip": null}}config部分。如果我删除"mark": {"tooltip": null},工具提示会自动工作。

所以,而不是这个

{
  "config": {"view": {"width": 400, "height": 300}, "mark": {"tooltip": null}},
  "data": {
    "url": "https://vega.github.io/vega-datasets/data/seattle-temps.csv"
  },
  "mark": "bar",
  "encoding": {
    "x": {"type": "quantitative", "bin": true, "field": "temp"},
    "y": {"type": "quantitative", "aggregate": "count"}
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v3.2.1.json"
}
Run Code Online (Sandbox Code Playgroud)

我想牛郎星输出到像这样

{
  "config": {"view": {"width": 400, "height": 300}},
  "data": {
    "url": "https://vega.github.io/vega-datasets/data/seattle-temps.csv"
  },
  "mark": "bar",
  "encoding": …
Run Code Online (Sandbox Code Playgroud)

python altair

1
推荐指数
1
解决办法
517
查看次数

标签 统计

altair ×1

python ×1