rankdir

type: rankdir, default: TB

Sets direction of graph layout.

For example, if rankdir="LR", and barring cycles, an edge T -> H; will go from left to right. By default, graphs are laid out from top to bottom.

This attribute also has a side-effect in determining how record nodes are interpreted. See record shapes.

Top to bottom (default)
digraph {
    rankdir="TB"
    a -> b -> c;
}
Bottom to top
digraph {
    rankdir="BT"
    a -> b -> c;
}
Left to right
digraph {
    rankdir="LR"
    a -> b -> c;
}
Right to left
digraph {
    rankdir="RL"
    a -> b -> c;
}
Valid on:
  • Graphs
Note: dot only
Last modified August 8, 2021 : Add rankdir example (30263c1)