Python NetworkX-保存在文件上的图形更改边厚度
在试图通过“savefig”函数将NetworkX图形保存到文件中时,我遇到了一个小问题。 我的图表如下所示: 但是,当我保存到文件中时,生成的已保存图形如下所示: 如你所见,在第二张图中,边是正常绘制的,没有考虑到我减小了它们的厚度这一事实。 我会把我的代码贴在这里,也许我做错了什么:Python NetworkX-保存在文件上的图形更改边厚度,python,file,layout,save,networkx,Python,File,Layout,Save,Networkx,在试图通过“savefig”函数将NetworkX图形保存到文件中时,我遇到了一个小问题。 我的图表如下所示: 但是,当我保存到文件中时,生成的已保存图形如下所示: 如你所见,在第二张图中,边是正常绘制的,没有考虑到我减小了它们的厚度这一事实。 我会把我的代码贴在这里,也许我做错了什么: # Retrieving the GCC from the undirected version of the graph GCC = max(nx.connected_component_subgraph
# Retrieving the GCC from the undirected version of the graph
GCC = max(nx.connected_component_subgraphs(UG), key=len)
pos = nx.spring_layout(GCC,k=0.30,iterations=70, scale=2)
nx.draw_networkx_nodes(GCC, pos,node_color=color_map,with_labels=True, node_size=17) #node_color=color_map, with_labels=True, node_size=17)
nx.draw_networkx_edges(GCC, pos, width=0.3)
# Saving graph in the main folder of the project
fig = plt.gcf()
fig.set_size_inches(18.5, 10.5)
fig.savefig('graph7.pdf', dpi=100)
plt.show()