import matplotlib.pyplot as plt
import networkx as nx
# store pairs to a list of tuples
tuples = [tuple(x) for x in df.values]
# set up a graph and show it
G = nx.DiGraph()
G.add_edges_from(tuples)
nx.draw_networkx(G)
plt.xticks([], [])
plt.yticks([], [])
plt.show()
作为一个例子,这里是一种使用
networkx
,pandas
,和matplotlib
来显示无向网络图的方法。在代码:
输出:
相关问题 更多 >
编程相关推荐