如何使用python nrtworkx將圖放大?
問題描述
生成圖片太小,不能看清節(jié)點(diǎn)間連線,太過密集,望能給出解決方法
# _*_ coding:utf-8 _*_import matplotlib.pyplot as pltimport networkx as nxG = nx.DiGraph()#加載文件中邊的關(guān)系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:建議網(wǎng)絡(luò)圖使用d3py,或者設(shè)置matplotlib的畫布大小
相關(guān)文章:
1. mysql - 如何減少使用或者不用LEFT JOIN查詢?2. 視頻文件不能播放,怎么辦?3. mysql - jdbc的問題4. Python爬蟲如何爬取span和span中間的內(nèi)容并分別存入字典里?5. 網(wǎng)頁爬蟲 - python 爬取網(wǎng)站 并解析非json內(nèi)容6. Python如何播放還存在StringIO中的MP3?7. python - 我在使用pip install -r requirements.txt下載時(shí),為什么部分能下載,部分不能下載8. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會(huì)帶來哪些效率或者其他方面的好處9. node.js - nodejs開發(fā)中常用的連接mysql的庫10. python - 編碼問題求助
