Graphviz 三柱图

Graphviz 三柱图,graphviz,diagrammer,Graphviz,Diagrammer,如何重现该图: 使用graphviz节点 我测试了几种排名组合,但都没有成功。下面是一个工作示例,它离目标还有相当大的距离: digraph cohort_flow_chart { node [fontname = Helvetica, fontsize = 12, shape = box, style = rounded, width = 4] a[label = '1,618,937 \n hospitalisations due to alcohol\n an

如何重现该图:

使用graphviz节点

我测试了几种排名组合,但都没有成功。下面是一个工作示例,它离目标还有相当大的距离:

    digraph cohort_flow_chart {
    

  node [fontname = Helvetica, fontsize = 12, shape = box, style = rounded, width = 4]
  a[label = '1,618,937 \n hospitalisations due to alcohol\n and substence use related disorders']
  d[label = '1,882,629 \n hospitalisations due to\n schizophrenia']
  f[label = '780,811\n hospitalisations due to\n mood disorders']

  c[label = '114 million \n Brazilian cohort']

  b[label = '2,250,454 \n hospitalisations due to\n diabetes mellitus']
  e[label = '19,646,098\n hospitalisations due to\n cardiovascular diseases']
  g[label = '278,540\n hospitalisations due to\n tuberculossis']
  
  {rank = same a, b}
  {rank = same c, d, e}
  {rank = same f, g}

}

您需要边或秩=源秩=汇将节点放到不同的秩上。
这将添加群集以获得,从而分别处理每个列:

digraph cohort_flow_chart {

 node [fontname = Helvetica, fontsize = 12, shape = box, style = rounded, width = 4]
 edge[style=invis]
 
  a[label = "1,618,937 \n hospitalisations due to alcohol\n and substence use related disorders"]
  d[label = "1,882,629 \n hospitalisations due to\n schizophrenia"]
  f[label = "780,811\n hospitalisations due to\n mood disorders"]

  c[label = "\n\n\n\n\n114 million \n Brazilian cohort\n\n\n\n\n\n" width=1.3]

  b[label = "2,250,454 \n hospitalisations due to\n diabetes mellitus"]
  e[label = "19,646,098\n hospitalisations due to\n cardiovascular diseases"]
  g[label = "278,540\n hospitalisations due to\n tuberculossis"]

  node[ style=invis label=""]
  d1 d2
  subgraph cluster_col1 { peripheries=0  a -> d -> f}
  subgraph cluster_col2 { peripheries=0  d1 -> c -> d2 }
  subgraph cluster_col3 { peripheries=0  b -> e -> g}
}
给予: