如何使用python nrtworkx將圖放大?
問(wèn)題描述

生成圖片太小,不能看清節(jié)點(diǎn)間連線,太過(guò)密集,望能給出解決方法
# _*_ 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()
問(wèn)題解答
回答1:建議網(wǎng)絡(luò)圖使用d3py,或者設(shè)置matplotlib的畫布大小
相關(guān)文章:
1. javascript - sublime快鍵鍵問(wèn)題2. javascript - immutable配合react提升性能?3. css - 寫頁(yè)面遇到個(gè)布局問(wèn)題,求大佬們幫解答,在線等,急!~4. javascript - nodejs關(guān)于進(jìn)程間發(fā)送句柄的一點(diǎn)疑問(wèn)5. Apache 已經(jīng)把網(wǎng)站根目錄的改為allow from all了,但是服務(wù)器還是不能訪問(wèn)?6. 實(shí)現(xiàn)bing搜索工具urlAPI提交7. 配置Apache時(shí),添加對(duì)PHP的支持時(shí)語(yǔ)法錯(cuò)誤8. vue.js - Vue 如何像Angular.js watch 一樣監(jiān)聽數(shù)據(jù)變化9. javascript - 移動(dòng)端上不能實(shí)現(xiàn)拖拽布局嗎?10. phpstudy8.1支持win11系統(tǒng)嗎?

網(wǎng)公網(wǎng)安備