Spread out graph

607 views
Skip to first unread message

Emily Levine

unread,
Jul 13, 2011, 12:23:11 PM7/13/11
to networkx-discuss
Hi again-
I am wondering what the simplest way to spread out a graph might be. I
have 38 nodes and 224 edges total and right now when I use a spring
layout, the nodes just appear to clumped to see any of the
connections. I was thinking either spreading out the nodes or
lengthening the edges, but the different posts I found about either of
those topics were a little too complicated for me to understand. Can
someone possibly explain how to do either of those things? Or if there
is a simpler way to spread out a graph, that would be helpful too.
Thank you,
Emily Levine

Aric Hagberg

unread,
Jul 13, 2011, 1:00:36 PM7/13/11
to networkx...@googlegroups.com

Here are two approaches:
1) Make nodes/fonts smaller
2) Make graph canvas larger

import pylab
import networkx as nx
G=nx.cycle_graph(80)
pos=nx.circular_layout(G)
pylab.figure(1)
nx.draw(G,pos)
pylab.figure(2)
nx.draw(G,pos,node_size=60,font_size=8) # smaller nodes and fonts
pylab.figure(3,figsize=(12,12)) # larger figure size
nx.draw(G,pos)
pylab.show()

Aric

Emily Levine

unread,
Jul 13, 2011, 1:32:12 PM7/13/11
to networkx-discuss
I am already using a rather large figure size, but making the fonts
smaller helped a little. However, the nodes are still clumped
together, making it impossible to see the connections. Are there any
other approaches?
Thanks

On Jul 13, 1:00 pm, Aric Hagberg <ahagb...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages