glejeune / Ruby-Graphviz

[MIRROR] Ruby interface to the GraphViz graphing tool
https://gitlab.com/glejeune/ruby-graphviz
Other
608 stars 116 forks source link

fixed positions and neato #21

Closed Skulli closed 13 years ago

Skulli commented 13 years ago

Is it possible to create graphs with fixed positions and using neato?

If i create nodes and set the pos attribute with values like "10,10!" and in addition pin=true, then the output doesnt use these coordinates except for the canon format.

Is there a way to append the -n value to the call of neato? That would use no layout engine then.

Skulli commented 13 years ago

would be cool to have an output option like (:output_params => "-n -s" which is appended to the programm.

glejeune commented 13 years ago

Hello,

I'm not sure to understand your question/problem... As you can see in sample54, pos (and pin) works...

Concerning the -n, -s (and other missing) options, no problem, i'll work on it.

Greg

Skulli commented 13 years ago

Hmm i see, then my code was correct but it didnt work for me.

Here is the output when i use canon output:

http://www.file-upload.net/download-3285640/hello_world.dot.html

these are the correct coordinates etc. When i use output png etc. then i just get an empty image.

When use the command "neato -T png hello_world.dot -o bla.png" then i get an empty image as well, i have to explicit set "-n" parameter to make it work. Also pin = true attribute doesnt do it for me (its supposed to be redundant with -n"

Maybe its a problem of my graphviz installation. Using Ubuntu 10.04, x64 and graphviz 2.20.2 But on the other hand, it works for me in your example. Somehow my coordinates are wrong.

Here is the code how i set the coords: g.add_node( farm.number.to_s, :pos => "#{farm.x_coord.to_f/5.0},#{farm.y_coord.to_f/5.0}!")

With the params i could workaround that problem atleast with setting "-n".

glejeune commented 13 years ago

I just push a version introducing "-n". To use it, just add a ":no_layout => [1|2]" option to GraphViz#output.

Otherwise, could you try with a more recent graphviz's version ?