Hvplot.networkx: Show node and edge attributes on hover

Hi everyone,

I managed to get the toolbar to show the node attributes, but am not getting any idea how to show the edge attribute on hovering an edge in the graph.

Here is a minimal example:

import networkx as nx
import hvplot.networkx as hvnx

g = nx.petersen_graph()
for n in g.nodes():
    if n < 5:
        g.nodes[n]["Country"] = "US"
        g.nodes[n]["Country"] = "DE"
for e in g.edges():
    g.edges[e]["Relation"] = "Good"

spring = hvnx.draw(g, with_labels=True)
# in a notebook

Currently, I do see the node attributes. How can we also render the edge attributes? I saw a bokeh example, but could not translate it to hvplot.

Thanks in advance,



spring = hvnx.draw(g, with_labels=True, inspection_policy = 'edges')

Thanks James @jbednar

What if we would like both edges and nodes? With the inspection policy attribute, I can only have either.


I’m not sure if that’s possible; I think that’s a Bokeh question.