1

I am using diagrammeR with grViz to generate a flow chart with multiple rows. The rows are grouped together properly, and the vertical order works well. Is there a way to specify justification of full rows (ranks)? I would like them to be centered. Below is code and an image of the example I am working with. I would like rows 3 and 4 to be centered.

Any input would be greatly appreciated. Thanks.

    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

Steve
  • 73
  • 6
  • Try `bio -> Met [label = 'Tier 1', [ bio -> Tr [label = 'Tier 1', weight = 10 ];` to start. Untested though! – vaettchen Jan 25 '18 at 16:44
  • I gave it a try, and it doesn't look like that changed the chart. Still off center. Thanks for the suggestion either way. – Steve Jan 26 '18 at 01:15
  • Try weight on some others. I can treat myself only over the weekend. – vaettchen Jan 26 '18 at 05:58

0 Answers0