如何使用python nrtworkx將圖放大?
問題描述
生成圖片太小,不能看清節點間連線,太過密集,望能給出解決方法
# _*_ coding:utf-8 _*_import matplotlib.pyplot as pltimport networkx as nxG = nx.DiGraph()#加載文件中邊的關系with open(’bigdata.txt’) as f: lines = f.readlines()mylist = [line.strip().split() for line in lines] pos =nx.spring_layout(G)outlist = []for i in range(len(mylist)): a = mylist[i][0] for j in range(len(mylist[i])-1):outlist.append([a, mylist[i][j+1]])#加載邊G.add_edges_from(outlist)nx.draw(G, with_labels=True, node_size=200,width=0.3, node_color=’r’, alpha = 0.7, edge_color=’black’,edge_vmin=2,edge_vmax=3)plt.savefig(’test1.png’)plt.show()
問題解答
回答1:建議網絡圖使用d3py,或者設置matplotlib的畫布大小
相關文章:
1. mysql - 請問數據庫字段為年月日,傳進的參數為月,怎么查詢那個月所對應的數據2. node.js - win 下 npm install 遇到了如下錯誤 會導致 無法 run dev么?3. javascript - 我的站點貌似被別人克隆了, google 搜索特定文章,除了域名不一樣,其他的都一樣,如何解決?4. 求救一下,用新版的phpstudy,數據庫過段時間會消失是什么情況?5. [python2]local variable referenced before assignment問題6. Python2中code.co_kwonlyargcount的等效寫法7. html - 移動端radio無法選中8. php - 微信開發驗證服務器有效性9. javascript - vue+iview upload傳參失敗 跨域問題后臺已經解決 仍然報403,這是怎么回事啊?10. mysql - 如何在有自增id的情況下,讓其他某些字段能不重復插入
