[英]In DiagrammeR, how to create an edge to a node, but not from a node?
在DiagrammeR中,如何创建节点的边缘而不是节点的边缘?
对于以下示例中的每个节点,我希望有一个传入边(代表来自模型外部的传入“错误”),最好带有标签。
library(DiagrammeR)
grViz("
digraph boxes_and_circles {
graph [nodesep = 2]
a -> {b c}
b -> {a c}
c -> {a b}
}
")
(由于某些原因,您需要信誉点来发布图像,所以我希望没有这个意义)
我认为只有通过一种变通方法才有可能,即放一些空白节点(如果我理解您的要求):
library(DiagrammeR)
grViz("
digraph boxes_and_circles {
# avoid distortion
graph [nodesep = 1, layout = circo]
node [shape = box,
fontname = Helvetica]
a;b;c
#invisible nodes
node [shape = circle,
fixedsize = true,
width = 0.9,
color = white,
fontcolor = white]
da;db;dc
# define the labels
edge [color = red, arrowhead = normal]
da -> a [label = 'a']
db -> b [label = 'b']
dc -> c [label = 'c']
edge [color = black, arrowhead = normal]
a -> {b c}
b -> {a c}
c -> {a b}
}
")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.