在 DiagrammeR 中,如何创建到节点的边,而不是从节点创建的边?
In DiagrammeR, how to create an edge to a node, but not from a node?
在 DiagrammeR 中,如何创建到节点的边而不是从节点创建的边?
对于下面示例中的每个节点,我想要一个传入边(代表来自模型外部的传入 'error'),最好带有标签。
library(DiagrammeR)
grViz("
digraph boxes_and_circles {
graph [nodesep = 2]
a -> {b c}
b -> {a c}
c -> {a b}
}
")
(出于某种原因,您需要 post 图片的声誉点数,所以我希望没有它也有意义)
我认为只有一种解决方法才有可能,即放置一些空白节点(如果我理解您的要求):
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}
}
")
在 DiagrammeR 中,如何创建到节点的边而不是从节点创建的边?
对于下面示例中的每个节点,我想要一个传入边(代表来自模型外部的传入 'error'),最好带有标签。
library(DiagrammeR)
grViz("
digraph boxes_and_circles {
graph [nodesep = 2]
a -> {b c}
b -> {a c}
c -> {a b}
}
")
(出于某种原因,您需要 post 图片的声誉点数,所以我希望没有它也有意义)
我认为只有一种解决方法才有可能,即放置一些空白节点(如果我理解您的要求):
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}
}
")