jerry
jerry

Reputation: 15

Creating Prisma diagram with horizontal and Vertical nodes included

I want to create a flow chart that contains both vertical and horizontal flowing nodes.

I have attempted to do this using library(DiagrammeR) with this code.

   library(DiagrammeR)

   grViz(diagram = "digraph flowchart {
   node [fontname = helvetica, fontsize = 9, shape = rounded, 
           penwidth = 1.0]
   graph[nodesep = 0.5]
   tab1 [label = '@@1']
   tab2 [label = '@@2']
   tab3 [label = '@@3']
   tab4 [label = '@@4']
   tab5 [label = '@@5']
   tab6 [label = '@@6']
   tab7 [label = '@@7']
   tab8 [label = '@@8']
   
   tab1 -> tab3;
   tab2 -> tab4;
   tab3 -> tab4;tab4 -> tab5;
   tab5 -> tab6;
   tab6 -> tab7;
   tab7 -> tab8;}

   [1]: 'KNOWN MAKE (N=500000)'
   [2]: 'MEN (N=400000)'
   [3]: 'UNKNOWN MAKE (N=12000)'
   [4]: 'CAR (N=488174)'
   [5]: 'PLANE (N=462050)'
   [6]: 'HORSE (N=442247)'
   [7]: 'BIKE (N=441912)'
  [8]: 'WALK (N=441343)'")

But, this only produces vertical flowing nodes- output included below.

flow chart - not desired output: flow chart - not desired output

I want the arrow that leads to ''WALK'' to flow from left to right (horizontal) of ''BIKE'' rather than down (vertical).

I asked this previously, but did not get the desired answer. I have now updated this to include a desired output.

Desired Output: Desired Output

Upvotes: 0

Views: 235

Answers (1)

Ben Welman
Ben Welman

Reputation: 301

Give tab7 and tab8 the same rank by adding {rank=same;tab7;tab8}

Upvotes: 0

Related Questions