简体   繁体   中英

Vega-Lite - How to plot an arrow?

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?

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"}
  }
}

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM