ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 04 Apr 2012 02:32:34 -0500How to plot generic graphs without nodes overlappinghttp://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/Hi all:
Regarding generic graphs (the nodes and edges type), is there a way to plot them without the nodes overlapping? Some node_overlap=False option?
Tue, 03 Apr 2012 13:34:59 -0500http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/Comment by araichev for <p>Hi all:</p>
<p>Regarding generic graphs (the nodes and edges type), is there a way to plot them without the nodes overlapping? Some node_overlap=False option?</p>
http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?comment=19994#post-id-19994Oh yeah, here's a specific example. I want to plot full n-trees and n=5 is the least value for which i get node overlap. sage: n = 5
sage: node = {}
sage: node[''] = [str(x) for x in range(n)]
sage: for x in range(n):
... node[str(x)] = [str(x) + str(y) for y in range(n)]
...
sage: g = Graph(node)
sage: P = g.plot(layout='tree', tree_root='')
sage: P.show()Tue, 03 Apr 2012 18:17:08 -0500http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?comment=19994#post-id-19994Comment by kcrisman for <p>Hi all:</p>
<p>Regarding generic graphs (the nodes and edges type), is there a way to plot them without the nodes overlapping? Some node_overlap=False option?</p>
http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?comment=19996#post-id-19996Our plotting algorithms *should* make the nodes not overlap... but maybe they do for huge graphs? A specific example would help our graph experts debug this. Thanks!Tue, 03 Apr 2012 16:03:39 -0500http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?comment=19996#post-id-19996Answer by niles for <p>Hi all:</p>
<p>Regarding generic graphs (the nodes and edges type), is there a way to plot them without the nodes overlapping? Some node_overlap=False option?</p>
http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?answer=13422#post-id-13422You need to adjust the size of the output picture; you can do this with the `figsize` keyword:
sage: n = 5
sage: node = {}
sage: node[''] = [str(x) for x in range(n)]
sage: for x in range(n):
... node[str(x)] = [str(x) + str(y) for y in range(n)]
...
sage: g = Graph(node)
sage: P = g.plot(layout='tree', tree_root='')
sage: P.show(figsize=[10,10])
For larger graphs, you'll probably need to use an even larger `figsize`, determined by the number of leaves on the bottom row.
Wed, 04 Apr 2012 02:32:34 -0500http://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?answer=13422#post-id-13422