[graph-tool] Graph drawing: overlay possible?

Steffen Schaper steffen.schaper at physics.ox.ac.uk
Mon Aug 8 17:03:38 CEST 2011


I think I found a way forward - may not be perfect, but works for the 
time being.

It looks like pin only works with neato and fdp - see 
http://www.graphviz.org/doc/info/attrs.html#d:pin

So I added layout='neato' to graph_draw, and that seems to do the trick. 
Unfortunately, the canvas size seems to change (even though I specified 
size=(15,15) for the initial layout and for the later call). My current 
workaround is to simply redraw the graph with neato and overwrite the 
output file.

One thing that suprised me is that pinning doesn't make things any 
faster. My network has almost 10000 nodes - does it really take most of 
the time to create output rather than performing the actual layout?

Cheers,
Steffen



On 08/08/11 16:28, Sebastian Weber wrote:
> This might not be very helping, but I gave up back then, when I had the problem. A solution would be great though…
>
> Cheers
>
> Am 08.08.2011 um 16:20 schrieb Steffen Schaper:
>
>> Hi,
>>
>> I am quite new to graph-tool and mostly use it for drawing at the moment.
>> Thanks Tiago for all the great work you put into graph-tool!
>>
>> Apologies for hijacking this thread - I hope this okay as my question is
>> basically the same that Sebastian had.
>>
>>
>> Tiago Peixoto wrote:
>>>> Theses colors would need to be transparent and the graph layout must
>>>> match in each drawing.
>>> Transparent colors are no problem, as well as matching the layout (you
>>> just need to pass the 'pos' parameter, and set 'pin=True' so that the
>>> positions remain fixed).
>>>
>>>
>> That's exactly what I tried, but for me, every time I call gt.graph_draw, I
>> get a new layout.
>>
>> Here's my code:
>>
>> #create network and properties...
>> #first plot. this works fine
>> positions = gt.graph_draw(network, vcolor=colorProperties, vcmap=colorMap,
>> vnorm=False, vorder=plotOrder, output='out0.png')
>>
>> # change a few values in colorProperties and plotOrder
>>
>> # now draw again
>> gt.graph_draw(network,pos=positions,pin=True,vcolor=colorProperties,vcmap=colorMap,vnorm=False,output='out1.png')
>>
>>
>> --
>> However, what happens is that the graph gets a new layout which is distinct
>> from the first one. Is there something I missed? I also tried to add
>> vprops={'pin':'True} to the second call of graph_draw, but that didn't help
>> either.
>>
>> I'm on Ubuntu 11.04, graph-tool version 2.2.14 (commit 39b848dc, Sat Jul 9
>> 00:53:56 2011 +0200) [from ppa], graphviz version 2.26.3.
>>
>> Cheers,
>> Steffen
>>
>>
>> --
>> View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Graph-drawing-overlay-possible-tp2742337p3235693.html
>> Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
>> _______________________________________________
>> graph-tool mailing list
>> graph-tool at skewed.de
>> http://lists.skewed.de/mailman/listinfo/graph-tool




More information about the graph-tool mailing list