summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcnfionawu <76815461+cnfionawu@users.noreply.github.com>2023-05-02 07:30:49 -0800
committerGitHub <noreply@github.com>2023-05-02 11:30:49 -0400
commitbc591fdbbe8385c8ceef3af180846fb3a971f2f8 (patch)
tree1eac6d8fd63ddc2cd569786939b804a649d1e1de
parent6caead937516c550c84240c9af15bff8fbdcd9e4 (diff)
downloadnetworkx-bc591fdbbe8385c8ceef3af180846fb3a971f2f8.tar.gz
Added docstring examples for nx_pylab.py (#6616)
Update nx_pylab.py
-rw-r--r--networkx/drawing/nx_pylab.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/networkx/drawing/nx_pylab.py b/networkx/drawing/nx_pylab.py
index 5a7fc54d..1a435774 100644
--- a/networkx/drawing/nx_pylab.py
+++ b/networkx/drawing/nx_pylab.py
@@ -1246,6 +1246,11 @@ def draw_circular(G, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.path_graph(5)
+ >>> nx.draw_circular(G)
+
See Also
--------
:func:`~networkx.drawing.layout.circular_layout`
@@ -1281,6 +1286,11 @@ def draw_kamada_kawai(G, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.path_graph(5)
+ >>> nx.draw_kamada_kawai(G)
+
See Also
--------
:func:`~networkx.drawing.layout.kamada_kawai_layout`
@@ -1315,6 +1325,11 @@ def draw_random(G, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.lollipop_graph(4, 3)
+ >>> nx.draw_random(G)
+
See Also
--------
:func:`~networkx.drawing.layout.random_layout`
@@ -1352,6 +1367,11 @@ def draw_spectral(G, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.path_graph(5)
+ >>> nx.draw_spectral(G)
+
See Also
--------
:func:`~networkx.drawing.layout.spectral_layout`
@@ -1389,6 +1409,11 @@ def draw_spring(G, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.path_graph(20)
+ >>> nx.draw_spring(G)
+
See Also
--------
draw
@@ -1429,6 +1454,12 @@ def draw_shell(G, nlist=None, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> shells = [[0], [1, 2, 3]]
+ >>> nx.draw_shell(G, nlist=shells)
+
See Also
--------
:func:`~networkx.drawing.layout.shell_layout`
@@ -1468,6 +1499,11 @@ def draw_planar(G, **kwargs):
>>> # Draw a subgraph, reusing the same node positions
>>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.draw_planar(G)
+
See Also
--------
:func:`~networkx.drawing.layout.planar_layout`