drawRoadsPlotlyScattergl.py 文件源码

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

项目:policosm 作者: ComplexCity 项目源码 文件源码
def plotRoadsGraphNetworkx(G):
    import matplotlib.pyplot as plt

    eoriginal=[(u,v) for (u,v,d) in G.edges(data=True) if d['level'] >= 3]
    enew=[(u,v) for (u,v,d) in G.edges(data=True) if d['level'] < 3]

    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=3)

    # edges
    nx.draw_networkx_edges(G,pos,edgelist=eoriginal,alpha=0.8,width=1)
    nx.draw_networkx_edges(G,pos,edgelist=enew,width=1,alpha=0.8,edge_color='r')

    # labels
    nx.draw_networkx_labels(G,pos,font_size=20,font_family='sans-serif')

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


问题


面经


文章

微信
公众号

扫码关注公众号