Vega-Lite - How to plot an arrow?

Viewed 309

I'm trying to produce a plot of a directed graph. Hence, I'd like to plot an arrow from one node to another. Is it possible to do this on Vega-Lite? And if yes, then how so?

1 Answers

There is no support for arrows on line segments in Vega-Lite. You can see the open feature request here: https://github.com/vega/vega-lite/issues/4270

For some applications, it might be suitable to annotate charts with unicode arrows; here is a brief example (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

Related