首页 > 解决方案 > 您如何在 Diagrammer 中设置边长?

问题描述

我不希望边缘标签与节点重叠。这可以手动完成吗?可以将边缘长度设置为不与所有边缘标签的节点重叠吗?
谢谢你。

例如红边:

library(DiagrammeR)
grViz("
digraph circo { 

  graph[layout = circo,
    overlap=false]  

  node[shape = circle,
       style=filled,
       color = grey,
       label = 'my label']
A[label='Jeffrey Jones']; B; C; D; E; F 

node[shape= rectangle]
1[label='This is a long label number 1']; 2; 3; 4; 5; 6; 7[label=number7];

# add edge statements 
A-> 1[label='This is my edge label', color=red, len=30.0]; B-2; B->3; B->4; C->A

}
") 

块输出

标签: rr-markdown

解决方案


我认为,这个简单的示例将对您有所帮助:

library(DiagrammeR)
grViz("
digraph {
  graph [ranksep = 0.2]
node [shape = circle]
  A [label = 'Jeffrey Jones']
  node [shape = rectangle]
  B [label = 'This is a long label number']
  C [label = 'Age']
edge [minlen = 3] #set minimum length here
  A->B [label='This is my edge label   ']
  A->C
  {rank = same; A; B}
}
")

在此处输入图像描述

从基础开始,然后更快地成长。

祝你好运 ;)


推荐阅读