0
Iは、ノードの色をプロットするために、次のコードを行い、ファイルからカラーマップエッジた:同じグラフ上の2つの異なるエッジカラーマップ?
## NODES COLORS##
Active={}
with open('NWWE/node'+str('{:03d}'.format(i))+'.txt', 'r') as f:
for j in f:
a,b=j.split(',')
Active[a]=b[0]
for node in G.nodes():
G.node[node]['category'] = Active[node]
color_map = {'0':'b', '1':'r'}
##EDGES COLOR MAP##
with open('NWWE/edges'+str('{:03d}'.format(i))+'.txt', 'r') as f:
for k in f:
a,b,c=k.split(',')
G[a][b]['weight']=float(c)
edges,weights = zip(*nx.get_edge_attributes(G,'weight').items())
##DRAW GRAPH##
nx.draw(G, pos, edgelist=edges, edge_color=weights, width=5.0, edge_cmap=plt.cm.Blues, node_color=[color_map[G.node[node]['category']] for node in G])
をしかし、私は種類ごとに異なる可能な重みと、ノード間の可能な接続の2つの種類を持っているので、私は希望エッジのために2つの異なるカラーマップを使用してグラフをプロットします。何か問題はありますか?
ありがとうございます!