drawRoadsNetworkx.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:policosm 作者: ComplexCity 项目源码 文件源码
def drawRoads(G, edgeColorAttribute='level', edgeColorScale=9, nodeColorAttribute=None, nodeColorScale=None):

    pos={}
    for n in G.nodes():
        pos[n] = (G.node[n]['longitude'],G.node[n]['latitude'])

    # nodes
    nx.draw_networkx_nodes(G,pos,node_size=0,alpha=0.8,color=colors[-1])

    # edges
    for i in range(0,9):
        selectedEdges = [(u,v) for (u,v,d) in G.edges(data=True) if d['level'] == i]
        selectedColors = [colors[i] for e in selectedEdges]
        nx.draw_networkx_edges(G,pos,edgelist=selectedEdges,width=edgeWidth[i],edge_color=selectedColors)

    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号