import networkx as nx
G = nx.graph_atlas(100)
nx.draw(G,with_labels=True)#with_labels=True节点上标有数字
2.用plt添加更多的修饰元素
import networkx as nx
import matplotlib.pyplot as plt
G = nx.graph_atlas(100)
nx.draw(G,with_labels=True)
plt.title('complete_graph')#子图的标题
plt.axis('on')#弄一个框框,框住graph
plt.xticks([])#横坐标不需要刻度
plt.yticks([])#纵坐标不需要刻度
3.一次性绘制多个网络图
import networkx as nx
import matplotlib.pyplot as plt
plt.subplot(211)
G = nx.graph_atlas(100)
nx.draw(G,with_labels=True)
plt.subplot(212)
G = nx.cycle_graph(8)
nx.draw(G,with_labels=True)
4.一次性绘制多幅图
import matplotlib.pyplot as plt
import networkx as nx
plt.subplots(2,2,figsize=(15,6))
plt.subplot(221)
er = nx.erdos_renyi_graph(10,0.15)
nx.draw(er, with_labels=True, font_weight='bold')
plt.title('erdos_renyi_graph')
plt.axis('on')
plt.xticks([])
plt.yticks([])
plt.subplot(222)
ws = nx.watts_strogatz_graph(30,3,0.1)
nx.draw(ws, wi