我有以下代码:
G = ox.graph_from_polygon(polygon, implify=True, custom_filter='["railway"~"rail"]')
edge_centrality = nx.closeness_centrality(nx.line_graph(G))
ev = [edge_centrality[edge + (0,)] for edge in G.edges()]
norm = colors.Normalize(vmin=min(ev), vmax=max(ev))
cmap = cm.ScalarMappable(norm=norm, cmap=cm.viridis)
ec = [cmap.to_rgba(cl) for cl in ev]
fig, ax = ox.plot_graph(G, bgcolor='k', edge_color=ec, node_color='w', node_size=10, edge_linewidth=1, edge_alpha=1)
节点是白色的。但是我希望在边上有与边颜色相同的节点。我试过:
... node_color=ec, node_alpha=None, ...
但它不起作用。
暂无答案!
目前还没有任何答案,快来回答吧!