Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Node Display Size in Networkx

I am not using GraphViz because I am having problems with making it play nice with Networkx. I know this is weird, but I've tried many suggestions to fix this problem, but I just seem to have some of the worst luck in the world. Therefore the problem that I have must be solved withing Networkx without using GraphViz.

My program reads a document and and tries to draw something of a MindMap based on the contents of the document. However, Networkx seems to have a default size when it comes to actually drawing the node. This is bad for me because a lot of text goes into each of my nodes. I need a way to increase the display-size of my nodes (arbitrarily, based on the size of the text that belongs in that node).

I have tried looking at the Networkx site, other questions on SO and about 200 search results from Google, with no luck.

like image 387
inspectorG4dget Avatar asked Mar 04 '10 22:03

inspectorG4dget


1 Answers

Try nx.draw(G, node_size=size), where size can be a scalar or an array of length equal to the number of nodes.

like image 196
Nick Avatar answered Oct 06 '22 09:10

Nick