# -*- coding: utf-8 -*-
"""
Created on Sun Dec 1 15:07:36 2019
@author: Administrator
"""
import networkx as nx
import matplotlib.pyplot as plt
from networkx import multigraph
import pandas as pd
mpl.rcParams["font.sans-serif"]=["SimHei"] #正常显示中文
mpl.rcParams["axes.unicode_minus"]=False # 正常显示负号
data = pd.read_csv(r'C:\Users\Administrator\Desktop\tongji.csv',encoding='gbk')
g = nx.Graph()
g.add_node('北京铁路局')
a = data['name'][:19]
b = data['num'][:19]
for i in a:
g.add_edge('北京铁路局',i)
plt.figure(figsize=(12, 8))
node_size = [i*300 for i in b]
nx.draw(g, with_labels=True,encoding='utf_8_sig', node_size=node_size)
plt.savefig(r'C:\Users\Administrator\Desktop\path.png') #存至本地
某公司与众中标公司关系图
最新推荐文章于 2023-12-02 17:32:36 发布