Search code examples
rdiagramdiagrammer

DiagrammeR general flow direction


I would like to produce a diagram with DiagramR.

This is my code

    require(DiagrammeR)
    grViz("
    digraph boxes_and_circles {
    node [shape = box,
        fontname = Helvetica]
    A; B; C; D
    B->A C->A D->B
    }
    ")

But I get this result

enter image description here

And I need like this one

enter image description here

How can I set flow direction to up?


Solution

  • You could to set the parameter rankdir and add the color to edge and node:

    library(DiagrammeR)
    grViz("
        digraph boxes_and_circles {
        
            rankdir = BT
        
           node [shape = box,
                 fontname = Helvetica,
                 color = gray
                ]
                A; B; C; D
    
           edge [color = gray]
                B->A C->A D->B
          }
        ")
    

    enter image description here