Skip to content

Commit

Permalink
doc review; improved references and added generic plotting docs
Browse files Browse the repository at this point in the history
  • Loading branch information
boothby committed Jan 25, 2023
1 parent 49a1862 commit 553581c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
18 changes: 16 additions & 2 deletions docs/reference/drawing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Chimera Graph Functions

chimera_layout
draw_chimera
chimera_node_placer_2d

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

Five-node clique embedded in a small Zephyr graph.


Generic Plotting Functions
--------------------------

.. automodule:: dwave_networkx.drawing.qubit_layout

.. autosummary::
:toctree: generated/

draw_qubit_graph
draw_embedding
draw_yield
normalize_size_and_aspect
draw_lineplot
4 changes: 2 additions & 2 deletions dwave_networkx/drawing/chimera_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def chimera_layout(G, scale=1., center=None, dim=2, plot_kwargs=None):
plot_kwargs : None or dict (default None)
A dict of keyword arguments to be used in a plotting function (see
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
are set to default values by the :func:`normalize_size_and_aspect`
function. Do nothing if ``plot_kwargs`` is None.
Expand Down Expand Up @@ -140,7 +140,7 @@ def chimera_node_placer_2d(m, n, t, scale=1., center=None, dim=2, plot_kwargs=No
plot_kwargs : None or dict (default None)
A dict of keyword arguments to be used in a plotting function (see
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
are set to default values by the :func:`normalize_size_and_aspect`
function. Do nothing if ``plot_kwargs`` is None.
Expand Down
4 changes: 2 additions & 2 deletions dwave_networkx/drawing/pegasus_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def pegasus_layout(G, scale=1., center=None, dim=2, crosses=False, plot_kwargs=N
plot_kwargs : None or dict (default None)
A dict of keyword arguments to be used in a plotting function (see
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
are set to default values by the :func:`normalize_size_and_aspect`
function. Do nothing if ``plot_kwargs`` is None.
Expand Down Expand Up @@ -131,7 +131,7 @@ def pegasus_node_placer_2d(G, scale=1., center=None, dim=2, crosses=False, plot_
plot_kwargs : None or dict (default None)
A dict of keyword arguments to be used in a plotting function (see
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
are set to default values by the :func:`normalize_size_and_aspect`
function. Do nothing if ``plot_kwargs`` is None.
Expand Down
4 changes: 2 additions & 2 deletions dwave_networkx/drawing/qubit_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from numbers import Number

__all__ = ['draw_qubit_graph']
__all__ = ['draw_qubit_graph', 'draw_embedding', 'draw_yield', 'normalize_size_and_aspect', 'draw_lineplot']


def draw_qubit_graph(G, layout, linear_biases={}, quadratic_biases={},
Expand Down Expand Up @@ -637,7 +637,7 @@ def draw_lineplot(G, layout, *, ax, node_size, width, nodelist=None,
edge_vmin=None, edge_vmax=None, z_offset=0):
"""Draws the graph G with line segments representing nodes.
This function is meant to be a drop-in replacement for :func:`networkx.draw`
This function is meant to be a drop-in replacement for :func:`networkx.drawing.nx_pylab.draw`
where nodes are associated with line segments (specified as 2x2 matrices
[[x0, y0], [x1, y1]]). This function makes significant assumptions about
the edges of the graph G, that hold when G is a Chimera, Pegasus, or Zephyr
Expand Down
8 changes: 4 additions & 4 deletions dwave_networkx/drawing/zephyr_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def zephyr_layout(G, scale=1., center=None, dim=2, plot_kwargs=None):
plot_kwargs : None or dict (default None)
A dict of keyword arguments to be used in a plotting function (see
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
are set to default values by the :func:`normalize_size_and_aspect`
are set to default values by the :func:`~dwave_networkx.drawing.qubit_layout.normalize_size_and_aspect`
function. Do nothing if ``plot_kwargs`` is None.
Returns
Expand Down Expand Up @@ -113,9 +113,9 @@ def zephyr_node_placer_2d(G, scale=1., center=None, dim=2, plot_kwargs=None):
plot_kwargs : None or dict (default None)
A dict of keyword arguments to be used in a plotting function (see
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge
:func:`networkx.drawing.nx_pylab.draw` and :func:`draw_lineplot`), to scale node and edge
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs``
are set to default values by the :func:`normalize_size_and_aspect`
are set to default values by the :func:`~dwave_networkx.drawing.qubit_layout.normalize_size_and_aspect`
function. Do nothing if ``plot_kwargs`` is None.
Returns
Expand Down

0 comments on commit 553581c

Please sign in to comment.