Labels position when plotting netwrokx

I was able to nicely plot a network directed graph (DiGraph) using the following:

nodes = hvnx.draw_networkx_nodes(
        dg, pos, node_color="yellow", with_labels=True
)
edges = hvnx.draw_networkx_edges(
        dg,
        pos,
        arrowstyle="->",
        arrowsize=10,
        edge_cmap="Blues",
        edge_width=2,
        colorbar=True,
    )
    return nodes * edges

The only problem I have (at the moment) is that the labels or directly on the nodes and thus hard to read. How can I control the location of the labels of the nodes?

I have a follow up question: the arrows rendered using the aforementioned code are overlapping the nodes. Is there a way to make it look nicer?

I’ll try to bump this question again. I’m still facing the same issues…

1 Like

Sorry you never got a reply here. Could you file an issue on hvPlot to control the positioning? For now I think appending .opts('Labels', xoffset=..., yoffset=...) should work.

What about the arrows? They are currently point to the center of the nodes and thus masking the text in the nodes.

I believe in Bokeh 2.3 (due to be released this week) Arrows can finally be vectorized, which means I no longer have to fake arrows by drawing paths manually. A HoloViews issue requesting Graph to use the vectorized arrows would be greatly appreciated.

Thanks for your help!

1 Like

Thanks! I really appreciate it.

1 Like