简体   繁体   English

Vega-Lite - 如何 plot 箭头?

[英]Vega-Lite - How to plot an arrow?

I'm trying to produce a plot of a directed graph.我正在尝试生成有向图的 plot 。 Hence, I'd like to plot an arrow from one node to another.因此,我想 plot 从一个节点到另一个节点的箭头。 Is it possible to do this on Vega-Lite?是否可以在 Vega-Lite 上执行此操作? And if yes, then how so?如果是,那又如何?

There is no support for arrows on line segments in Vega-Lite. Vega-Lite 不支持线段上的箭头。 You can see the open feature request here: https://github.com/vega/vega-lite/issues/4270您可以在此处查看开放功能请求: https://github.com/vega/vega-lite/issues/4270

For some applications, it might be suitable to annotate charts with unicode arrows;对于某些应用程序,可能适合使用 unicode 箭头注释图表; 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"}
  }
}

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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