[Haskell-cafe] Three questions to graphviz
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Tue Oct 11 00:21:00 CEST 2011
On 11 October 2011 03:44, kaffeepause73 <kaffeepause73 at yahoo.de> wrote:
> First of all - thanks a lot for this package, graphviz is an awesome tool and
> having this interface library is really convenient. There a three point
> where I could use some help:
> 2. I know how to rotate the whole diagram (with landscape or rotate 90), but
> not how to keep
> all the text in unrotated position -- is there a command to do this ?
I don't think this is possible: the rotation seems to be a
post-processing feature done by GraphViz. If you just want the graph
laid out Left-to-Right rather than Top-to-Bottom, try setting the
(though I've just noticed that the Ordering attribute should take in a
specific type rather than just Text... *goes off to fix*)
> 3. When I create a symmetric tree with two directions on the two sides. The
> tree gets completely messed up when I enter the right directions. (left
> graph ok but wrong edge dirs, right graph with correct dirs but gemetry
> scambled). - It has todo with ranking order which is based on the direction
> of the edges. I can fake it with reversing the arrows in the diagram, but my
> original graph data is coming directed ...
This means you need to tweak and play around with the settings more.
My approach (and I'm the maintainer of the graphviz library!) for
stuff like this is:
* Get some sample Dot code (either write it by hand or use graphviz to
generate it from your data).
* Look through all the available attributes for ones that might deal
with layout of nodes, edges, etc. at:
* Try setting them into your Dot code, then use the appropriate
Graphviz command (dot, neato, circo, etc. depending on which layout
you want); consider something like "dot -Txlib test.dot" to get a
preview window up, or "dot -Tpng test.dot > test.png" to get a png
* Once you've found attributes that seem to do what you want, use the
graphviz versions of them in your Haskell code.
Note also that because Graphviz uses automatic layout algorithms, you
can't always get it to output in the way that would make sense if you
drew it by hand. I've been told that things like phantom nodes
(invisible nodes that you insert with extra edges to force spaces,
alignment, etc.) can help, but I've never looked into using them
enough to work out approaches of how/when to do so.
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
More information about the Haskell-Cafe