grViz diagrammeR:证明节点行

时间:2018-01-25 15:09:26

标签: r graphviz diagrammer

我正在使用带有grViz的diagrammeR来生成包含多行的流程图。行正确分组,垂直顺序很好。有没有办法指定完整行(排名)的理由?我希望他们能够集中精力。下面是代码和我正在使用的示例的图像。我希望第3行和第4行居中。

任何输入都将不胜感激。 感谢。

    library("DiagrammeR")

grViz(" 
      digraph CFA {
      # Multiple level nodes
      node [shape = rectangle, color=CornflowerBlue]


      a [label = <<FONT COLOR='blue' POINT-SIZE='18'><b>Surveillance 2017  </b> <br/>Urban Mixtures</FONT>> ]; 

      # http://www.graphviz.org/doc/info/shapes.html#html

      #Tiers
      node [shape = ellipse, color=CornflowerBlue]
      T1    [label = <<u><b><font color = 'forestgreen' point-size = '16'>Tier 1</font></b></u><br/>Water Quality <br/> 16 Watersheds <br/> Quarterly sampling>]; 
      T2    [label = <<u><b><font color = 'forestgreen' point-size = '16'>Tier 2</font></b></u> <br/> Sediment and Passive sampling <br/> 72 Sites>]; 

      #Media assays and ancillary
      chem  [label = 'Water \\nChemistry']; 
      bio   [label = 'Bio-effects'];
      Anc   [label = 'Ancillary \\ndata']
      sed [label = 'Sediment \\nChemistry']; 
      pass [label = 'Passive Sampler \\nChemistry']; 

      # Analyses
      node [shape = box, color = Crimson] 
      owc  [label = 'Waste Indicators'];
      PFAS  [label = 'PFAS: 30 sites']
      PAH  [label = 'PAHs'];
      Att  [label = 'Attagene'];
      Met  [label = 'Metabolomics'];
      Tr   [label = 'Transcriptomics'];

      Hyd  [label = 'Hydrology'];
      WA   [label = 'Watershed \\nAttributes']

      # Synthesis
      node [shape = 'egg',color = ' forestgreen']
      Syn  [label = 'Synthesis'];
      Tx   [label = 'ToxEval\\nHTS/AOP analysis']

      {rank = same; T1 T2}
      {rank = same; chem bio pass sed Anc}
#      {rank = same; PFAS; PAH; WA; Hyd; owc;Att;Met;Tr}
      {rank = same; PFAS; PAH; Hyd; owc;WA; Hyd}
      {rank = same; Att;Met;Tr}
      {rank = same; Tx; Syn}
      # Connect nodes with edges and labels
      T1 -> a[dir=back]
      a -> T2#[dir=back]
      T1 -> {bio chem Anc}
      T2 -> {bio sed Anc pass chem}
      Anc -> {Hyd WA}
      chem -> {owc}
      chem -> PFAS [label = 'Tier 2']
      sed -> {owc PAH}
      pass -> PAH
      bio -> {Met Tr} [label = 'Tier 1']
      bio -> {Att} [label = 'Tier 2']

      {owc Att Met Tr Hyd WA PAH PFAS} -> Syn
      {owc PAH PFAS} -> Tx
      Tx -> Syn
      }


      ")

example flow chart

0 个答案:

没有答案