我正在尝试使用 graphviz 生成一个图形,该图形会产生像这样的可视化效果(!;https://www.google.com/url?sa=i&source=images&cd=&ved=2ahUKEwjcgcDdvcHjAhXG854KHaMHB2EQjRx6BAgBEAU&url=https%3A%2F%2Fwww .kathartman.com%2Fvisualizing-detroits-civic-tech-ecosystem&psig=AOvVaw1P66IWi0HPrMZQMmEP_MuS&ust=1563642864370970 )。我目前的策略是生成一个节点的外圈(已实现),现在想将节点添加到可视化的中心(到目前为止不成功!)。
我已经探索了子图集群,这似乎是最干净的解决方案,但还没有找到一种方法来改变 circo 布局中的布局。我还探索过合并两个不同的图表,但还没有找到一种方法来做到这一点。我还尝试了其他 r 包(例如 visnetwork、networkd3、circlize),其中 diagrammeR/graphviz 似乎再次成为最明显的解决方案......
grViz("graph {
graph [bgcolor = 'white',layout = 'circo',
outputorder = 'edgesfirst']
subgraph cluster0 {
node [shape = 'rectangle',fontsize = 22,fontname = 'Helvetica',
fontcolor = 'black', width = 3, height = 1.25, style = 'dotted',
penwidth = 5]
'1'
'2'
'3'
node [shape = 'plaintext',fontsize = 16,fontname = 'Helvetica',
width = 1, height = 1]
'18'
'5'
node [shape = 'plaintext',fontsize = 16, fontname = 'Helvetica',
fontcolor = 'black']
'4'
'9'
'6'
node [fillcolor = OldLace,
fontsize = 11,fontsize = 14]
'7'
'8'
'21'
'22'
'23'
'10'
'20'
edge [weight = 0.5,penwidth = 4, fontname = 'Helvetica',
fontsize = '12', len = '1.5', color = 'gray80',
arrowsize = '0.5']
'1'--'18'
'18'--'4'
'4'--'7'
'7'--'8'
'8'--'2'
'2'--'5'
'5'--'9'
'9'--'21'
'21'--'22'
'22'--'23'
'23'--'3'
'3'--'6'
'6'--'10'
'10'--'20'
'20'--'1'}
subgraph cluster1 {
# Projects
node [fontname = 'Helvetica',
fontsize = '7', shape = 'circle',
fixedsize = 'true', width = '0.5',
style = 'filled', fillcolor = 'aliceblue',
fontcolor = 'gray50']
'11'
'12'
'13'
'14'
'15'
'16'
'17'
'19'
edge [weight = 0.25,fontname = 'Helvetica',
fontsize = '12', len = '1.5', color = 'gray80',
arrowsize = '0.5']
'6'--{'10' '17' '19'}
'7'--{'11' '19'}
'8'--{'12' '13' '14' '15'}
'9'--{'12' '13' '14' '16'}
}
}")
目标是第二个子集群(或第二个图)在第一个子集群内形成一个网络,同时仍然显示它们之间的边。目前,第 2 个子集群位于圆的外部并保持圆环布局