如何使用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. 如何解決docker宿主機(jī)無法訪問容器中的服務(wù)?2. angular.js - $stateChangeSuccess事件在狀態(tài)跳轉(zhuǎn)的時(shí)候不執(zhí)行?3. mysql 一個(gè)sql 返回多個(gè)總數(shù)4. java如何生成token?5. javascript - 螞蟻金服里的react Modal方法,是怎么把元素插入到頁(yè)面最后的6. 如何用筆記本上的apache做微信開發(fā)的服務(wù)器7. android - rxjava merge 返回Object對(duì)象數(shù)據(jù)如何緩存8. CSS3 畫如下圖形9. python - Scrapy存在內(nèi)存泄漏的問題。10. angular.js - ionic2 瀏覽器跨域問題
