plot - Vega-Lite - 如何绘制箭头?

标签 plot graph vega-lite

我正在尝试绘制有向图。因此,我想从一个节点绘制一个箭头 到另一个。可以在 Vega-Lite 上执行此操作吗?如果是,那又如何呢?

最佳答案

Vega-Lite 中不支持线段上的箭头。您可以在此处查看开放功能请求:https://github.com/vega/vega-lite/issues/4270

对于某些应用程序,使用 unicode 箭头注释图表可能比较合适;这是一个简短的示例( open in editor ):

{
  "data": {
    "values": [{"x": 1, "y": 2}, {"x": 2, "y": 4}]
  },
  "mark": {"type": "text", "angle": -45, "dx": -20, "fontSize": 35},
  "encoding": {
    "text": {"value": "➟"},
    "x": {"field": "x", "type": "quantitative"},
    "y": {"field": "y", "type": "quantitative"}
  }
}

enter image description here

关于plot - Vega-Lite - 如何绘制箭头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65304489/

相关文章:

r - 使用 ggplot 绘制时间标签覆盖率

r - R 中带导数的标签轴

Vega-Lite - 处理大量数据的最佳方式是什么?

python - Altair 条件颜色散点图

python - 分层树的视觉替代方案 : (((A, B),(C,D)),E)?

python - 使用 pandas 在 matplotlib 中绘图

php - PHP 中的 Edmonds 最大匹配算法

r - 在 R 中绘制折线图的交点

vega-lite - 如何在 Vega Lite 中重命名图例标签?

r - "zero-length arrow"有多小?