Skip to content

Commit

Permalink
Merge e1a8257 into 1c35fdb
Browse files Browse the repository at this point in the history
  • Loading branch information
MridulS committed Jan 24, 2022
2 parents 1c35fdb + e1a8257 commit 4288ce5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/user_guide/NetworkX.ipynb
Expand Up @@ -42,6 +42,16 @@
"spring + shell"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"H = nx.triangular_lattice_graph(1, 20)\n",
"hvnx.draw_planar(H, node_color='green', edge_color='brown')"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
19 changes: 19 additions & 0 deletions hvplot/networkx.py
Expand Up @@ -582,3 +582,22 @@ def draw_spring(G, **kwargs):
Graph element or Graph and Labels
"""
return draw(G, nx.spring_layout, **kwargs)

def draw_planar(G, **kwargs):
"""Draw networkx graph with planar layout.
Parameters
----------
G : graph
A networkx graph
kwargs : optional keywords
See hvplot.networkx.draw() for a description of optional
keywords, with the exception of the pos parameter which is not
used by this function.
Returns
-------
graph : holoviews.Graph or holoviews.Overlay
Graph element or Graph and Labels
"""
return draw(G, nx.planar_layout, **kwargs)

0 comments on commit 4288ce5

Please sign in to comment.