Control labels position when plotting Networkx
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 124
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 1
Description
#### Is your feature request related to a problem? Please describe.
When plotting a graph (given as a Networkx object), there's no easy control on the position of the labels.
```python
G = nx.DiGraph()
G.add_node("a")
G.add_node("b")
G.add_edge("a", "b")
pos = nx.layout.planar_layout(G)
nodes = hvnx.draw_networkx_nodes(
G, pos, with_labels=True
)
edges = hvnx.draw_networkx_edges(
G, pos, arrowstyle="->"
)
nodes * edges
```
Based on the suggestion by @philippjfr [see here](https://discourse.holoviz.org/t/labels-position-when-plotting-netwrokx/1211/4), adding `.opts('Labels', xoffset=.0, yoffset=.09)` to the nodes drawing controls the position of the labels.
This is working as expected but probably could be part of the drawing function itself.
Contributor guide
Assessment
This issue has not been assessed yet.