Skip to content

Commit 553581c

Browse files
committed
doc review; improved references and added generic plotting docs
1 parent 49a1862 commit 553581c

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

docs/reference/drawing.rst

+16-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Chimera Graph Functions
2121

2222
chimera_layout
2323
draw_chimera
24+
chimera_node_placer_2d
2425

2526
Example
2627
~~~~~~~
@@ -89,8 +90,6 @@ of nodes of a simple 5-node graph on a small Pegasus lattice.
8990
edge_list=[(4, 40), (4, 41), (4, 42), (4, 43)])
9091
>>> # Show graph H on a small Pegasus lattice
9192
>>> plt.ion()
92-
>>> # Show graph H on a small Pegasus lattice
93-
>>> plt.ion()
9493
>>> dnx.draw_pegasus(G, with_labels=True, crosses=True, node_color="Yellow")
9594
>>> dnx.draw_pegasus(H, crosses=True, node_color='b', style='dashed',
9695
edge_color='b', width=3)
@@ -141,3 +140,18 @@ of a five-node clique on a small Zephyr graph.
141140
:alt: Five-node clique embedded in a small Zephyr graph.
142141

143142
Five-node clique embedded in a small Zephyr graph.
143+
144+
145+
Generic Plotting Functions
146+
--------------------------
147+
148+
.. automodule:: dwave_networkx.drawing.qubit_layout
149+
150+
.. autosummary::
151+
:toctree: generated/
152+
153+
draw_qubit_graph
154+
draw_embedding
155+
draw_yield
156+
normalize_size_and_aspect
157+
draw_lineplot

dwave_networkx/drawing/chimera_layout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def chimera_layout(G, scale=1., center=None, dim=2, plot_kwargs=None):
5353
5454
plot_kwargs : None or dict (default None)
5555
A dict of keyword arguments to be used in a plotting function (see
56-
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
56+
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
5757
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
5858
are set to default values by the :func:`normalize_size_and_aspect`
5959
function. Do nothing if ``plot_kwargs`` is None.
@@ -140,7 +140,7 @@ def chimera_node_placer_2d(m, n, t, scale=1., center=None, dim=2, plot_kwargs=No
140140
141141
plot_kwargs : None or dict (default None)
142142
A dict of keyword arguments to be used in a plotting function (see
143-
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
143+
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
144144
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
145145
are set to default values by the :func:`normalize_size_and_aspect`
146146
function. Do nothing if ``plot_kwargs`` is None.

dwave_networkx/drawing/pegasus_layout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def pegasus_layout(G, scale=1., center=None, dim=2, crosses=False, plot_kwargs=N
6060
6161
plot_kwargs : None or dict (default None)
6262
A dict of keyword arguments to be used in a plotting function (see
63-
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
63+
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
6464
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
6565
are set to default values by the :func:`normalize_size_and_aspect`
6666
function. Do nothing if ``plot_kwargs`` is None.
@@ -131,7 +131,7 @@ def pegasus_node_placer_2d(G, scale=1., center=None, dim=2, crosses=False, plot_
131131
132132
plot_kwargs : None or dict (default None)
133133
A dict of keyword arguments to be used in a plotting function (see
134-
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
134+
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
135135
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
136136
are set to default values by the :func:`normalize_size_and_aspect`
137137
function. Do nothing if ``plot_kwargs`` is None.

dwave_networkx/drawing/qubit_layout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from numbers import Number
2929

30-
__all__ = ['draw_qubit_graph']
30+
__all__ = ['draw_qubit_graph', 'draw_embedding', 'draw_yield', 'normalize_size_and_aspect', 'draw_lineplot']
3131

3232

3333
def draw_qubit_graph(G, layout, linear_biases={}, quadratic_biases={},
@@ -637,7 +637,7 @@ def draw_lineplot(G, layout, *, ax, node_size, width, nodelist=None,
637637
edge_vmin=None, edge_vmax=None, z_offset=0):
638638
"""Draws the graph G with line segments representing nodes.
639639
640-
This function is meant to be a drop-in replacement for :func:`networkx.draw`
640+
This function is meant to be a drop-in replacement for :func:`networkx.drawing.nx_pylab.draw`
641641
where nodes are associated with line segments (specified as 2x2 matrices
642642
[[x0, y0], [x1, y1]]). This function makes significant assumptions about
643643
the edges of the graph G, that hold when G is a Chimera, Pegasus, or Zephyr

dwave_networkx/drawing/zephyr_layout.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def zephyr_layout(G, scale=1., center=None, dim=2, plot_kwargs=None):
5454
5555
plot_kwargs : None or dict (default None)
5656
A dict of keyword arguments to be used in a plotting function (see
57-
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
57+
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
5858
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
59-
are set to default values by the :func:`normalize_size_and_aspect`
59+
are set to default values by the :func:`~dwave_networkx.drawing.qubit_layout.normalize_size_and_aspect`
6060
function. Do nothing if ``plot_kwargs`` is None.
6161
6262
Returns
@@ -113,9 +113,9 @@ def zephyr_node_placer_2d(G, scale=1., center=None, dim=2, plot_kwargs=None):
113113
114114
plot_kwargs : None or dict (default None)
115115
A dict of keyword arguments to be used in a plotting function (see
116-
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
116+
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
117117
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
118-
are set to default values by the :func:`normalize_size_and_aspect`
118+
are set to default values by the :func:`~dwave_networkx.drawing.qubit_layout.normalize_size_and_aspect`
119119
function. Do nothing if ``plot_kwargs`` is None.
120120
121121
Returns

0 commit comments

Comments
 (0)