我正在使用带有 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
}
")