DiagrammeR general flow direction

193 views Asked by At

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?

1

There are 1 answers

1
s__ On BEST ANSWER

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