ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 04 Apr 2012 09:32:34 +0200How to plot generic graphs without nodes overlappinghttps://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 20:34:59 +0200https://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/Comment 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>
https://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 23:03:39 +0200https://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?comment=19996#post-id-19996Comment 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>
https://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()Wed, 04 Apr 2012 01:17:08 +0200https://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?comment=19994#post-id-19994Answer 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>
https://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 09:32:34 +0200https://ask.sagemath.org/question/8850/how-to-plot-generic-graphs-without-nodes-overlapping/?answer=13422#post-id-13422