DiagrammeR neato 组织结构图(如何向 grViz 添加标签?)

DiagrammeR neato org chart (howto add labels to grViz?)

如何向 DiagrammeR GraphViz 布局添加名称(或标签)?我想为下面的每个点添加名称,并且我希望它们以一种有组织的方式出现,而不是与其他任何东西重叠,一种 la ggrepel 风格。对于以下示例,您可以使用任何名称。这基本上是一个组织结构图。谢谢。

library(DiagrammeR)
grViz("
digraph neato {

graph [layout = neato]

node [shape = circle,
      style = filled,
      color = grey,
      label = '']

node [fillcolor = red]
a

node [fillcolor = green]
b c d

node [fillcolor = orange]

edge [color = grey]
a -> {b c d}
b -> {e f g h i j}
c -> {k l m n o p}
d -> {q r s t u v}
}")

节点后添加[label = 'your label']。您可以单独或内联声明节点的标签。

grViz("
digraph neato {

graph [layout = neato]

node [shape = circle,
      style = filled,
      color = grey,
      label = '']

node [fillcolor = red]
a [label='a']

node [fillcolor = green]
b c d

node [fillcolor = orange]

l [label = 'llllllllllllll', fixedsize = true, width = 0.5]

edge [color = grey]
a -> {b c d}
b -> {e f g h i j}
c -> {k l m n o [label = 'o'] p [label = 'p']}
d -> {q r s t u v}
}")