Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diagrammer: how to add labels to mermaid connectors

Tags:

r

diagrammer

I am trying R DiagrammeR library, and can noT add a label for the connectors between boxes... My code (which works fine) is:

library(DiagrammeR)
mermaid("
graph TD
        A[node 1]-->B[node 2]
        A-->C[node 3]
        C-->E[another node]
        B-->D[node 4]
        ")

Using the function grViz of the same library, labels could be added like:

 A[label:'This is the NO path"]

but this way gives error in mermaid function... I tried:

 A[node 1]-->B[node 2][label="test"]
 A[node 1]-->B[node 2, label="test"]

and many others with no success.

I want something similar to this diagramm with the 'YES' added in a connection enter image description here

Any ideas? Thanks in advance!

like image 729
COLO Avatar asked Nov 29 '17 15:11

COLO


Video Answer


1 Answers

The solution is available here. Add |Yes| between A--> and C[node 3].

library(DiagrammeR)
mermaid("
graph TD
        A[node 1]--> B[node 2]
        A-->|Yes| C[node 3]
        C-->E[another node]
        B-->D[node 4]
        ")

enter image description here

like image 140
Marco Sandri Avatar answered Sep 30 '22 17:09

Marco Sandri