如何在 R 顺序美人鱼图中添加横向融合箭头? 在下面的例子中:
library(DiagrammeR)
mermaid("
graph TB
A[GE Solution]-->C{1:1}
B[GA Solution]-->C{1:1}
C{1:1}-->D[Stir 10 mins at 500 r/min]
D[Stir 10 mins at 500 r/min]-->E[Homogenisation at 10000 r/min]
")
我怎样才能制作出如下所示的东西?
我玩过
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'}")
@Paulo 答案的替代解决方案:
根据你的图片,我认为这看起来最好:
---
config:
flowchart:
curve: linear
---
flowchart TD
A[GE Solution] --- recEmpty[ ]:::empty
B[GA Solution] --- recEmpty
recEmpty --> C[Stir 10 mins at 500 r/min]
classDef empty width:0px
其他例子:
flowchart-elk TD
A[GE Solution] --- recEmpty[ ]:::empty
B[GA Solution] --- recEmpty
recEmpty --> C[Stir 10 mins at 500 r/min]
classDef empty width:0px
flowchart TD
A[GE Solution] --- recEmpty[ ]:::empty
B[GA Solution] --- recEmpty
recEmpty --> C[Stir 10 mins at 500 r/min]
classDef empty width:0px
---
config:
flowchart:
curve: stepAfter
---
flowchart TD
A[GE Solution] --- recEmpty[ ]:::empty
B[GA Solution] --- recEmpty
recEmpty --> C[Stir 10 mins at 500 r/min]
classDef empty width:0px