Hacking Off

20% Time All the Time

How to Make Ruby-Graphviz Draw Left-to-Right

1
2
3
4
5
require 'graphviz'
# ...
graph = GraphViz::new
graph[:rankdir] = "LR"
# ...

The default (top-to-bottom) behavior is accomplished via using “TB” instead of “LR”, or by just never specifying graph[:rankdir].

For a more in-depth example, see sample 35 from Ruby-Graphviz’s examples on GitHub.

Features undocumented by Ruby-Graphviz can occasionally be accessed. Just experiment with stuff from the Node, Edge, and Graph Attributes list on GraphViz’s site.