边缘悬停效果

时间:2021-01-28 10:09:09

标签: graph networkx geopandas osmnx

我试图在鼠标悬停(边缘)时显示边缘信息(名称、速度、长度、车道)。 你能帮我吗?

import mplcursors
ox.config(use_cache=True, log_console=True)

place_name = 'Cergy, France'
graph_cergy = ox.graph_from_place(place_name, network_type = 'drive')
G = ox.get_undirected(graph_cergy)
fig, ax = ox.plot_graph(G, bgcolor='k', edge_color='y', edge_linewidth=3, node_size=0,
                    show=False, close=False, figsize=(25,25))

for _, edge in edges.fillna('').iterrows():
    c = edge['geometry'].centroid
    text = edge['name']
    #ax.annotate(text, (c.x, c.y), c='w')
    mplcursors.cursor(text)

plt.show()

0 个答案:

没有答案