How can I specify an exact output size for my networkx graph?

You could try either smaller nodes/fonts or larger canvas. Here is a way to do both:

import networkx as nx
import matplotlib.pyplot as plt

G = nx.cycle_graph(80)
pos = nx.circular_layout(G)

# default
plt.figure(1)
nx.draw(G,pos)

# smaller nodes and fonts
plt.figure(2)
nx.draw(G,pos,node_size=60,font_size=8) 

# larger figure size
plt.figure(3,figsize=(12,12)) 
nx.draw(G,pos)
plt.show()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)