我尝试使用mermaid
,但不确定其中是否有相应功能。似乎它旨在成为简单的文档解决方案,而非具备很高灵活性的解决方案。但你可以使用graphViz完成同样的图示:
library(DiagrammeR)
grViz("digraph dot {
node [shape=rectange];
d1 [shape=point,width=0.01,height=0.01];
{'GE Solution', 'GA Solution'}->d1[dir=none];
d1->'Stir 10 mins at 500 r/min';
'Stir 10 mins at 500 r/min'->'Homogenisation at 10000 r/min'}")
编辑以回应评论:使用子图并对一个看不见的点(例如此处的d2
)和您希望与其在同一水平线上的节点相同(此处为40oC
)进行排序。
grViz("digraph dot {
node [shape=rectange];
d1 [shape=point,width=0.01,height=0.01];
d2 [shape=point, width=0.01, height=0.01];
{'GE Solution', 'GA Solution'}->d1[dir=none];
d1->'Stir 10 mins at 500 r/min';
'Stir 10 mins at 500 r/min'->d2[dir=none];
subgraph {
rank=same;
d2; '40oC';
}
d2->'40oC'[dir=none];
d2->'Homogenisation at 10000 r/min'}")
{ rank=same; d2 -> '40oC'[dir=none] };
。 - user20650
X & Y --- D[ ]:::empty --> E
。 - Ivo Merchiersgraph LR X & Y --- D( ):::empty D --> E classDef empty width:-1px,height:-1px;
至少在节点上画一个小圆圈 - 这样... 在我看来比空白的地方稍微好看一点。https://gist.github.com/chrismo/deccb12b9220a5ac357f64ceeb6ac54a/93f71466ba41cd395565b2cfe460efac4630be84 - chrismoclassDef empty width:0px,height:0px;
时,箭头之间出现了间隙。然而,如果我使用style D width:0;
就足够了。文档:节点样式化 - icc97