我正在尝试绘制有向图。因此,我想从一个节点绘制一个箭头 到另一个。可以在 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"}
}
}
关于plot - Vega-Lite - 如何绘制箭头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65304489/