Skip to content

Commit

Permalink
silenced warning due to unused arguments passed through draw_qubit_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
boothby committed May 10, 2023
1 parent 055adb3 commit 0ccb583
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions dwave_networkx/drawing/qubit_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@


def draw_qubit_graph(G, layout, linear_biases={}, quadratic_biases={},
nodelist=None, edgelist=None, cmap=None, edge_cmap=None, vmin=None, vmax=None,
edge_vmin=None, edge_vmax=None, midpoint=None,
nodelist=None, edgelist=None, midpoint=None,
**kwargs):
"""Draws graph G according to layout.
Expand Down Expand Up @@ -103,6 +102,18 @@ def draw_qubit_graph(G, layout, linear_biases={}, quadratic_biases={},
if edgelist is None:
edgelist = G.edges()

# since we're applying the colormap here, matplotlib throws warnings if
# we provide these arguments and it doesn't use them.
if linear_biases:
cmap = kwargs.pop('cmap', None)
vmin = kwargs.pop('vmin', None)
vmax = kwargs.pop('vmax', None)

if quadratic_biases:
edge_cmap = kwargs.pop('edge_cmap', None)
edge_vmin = kwargs.pop('edge_vmin', None)
edge_vmax = kwargs.pop('edge_vmax', None)

if cmap is None:
cmap = plt.get_cmap('coolwarm')

Expand Down Expand Up @@ -178,10 +189,7 @@ def node_color(v):
if ax is None:
ax = fig.add_axes([0.01, 0.01, 0.98, 0.98])

draw(G, layout, ax=ax, nodelist=nodelist, edgelist=edgelist,
cmap=cmap, edge_cmap=edge_cmap, vmin=vmin, vmax=vmax, edge_vmin=edge_vmin,
edge_vmax=edge_vmax,
**kwargs)
draw(G, layout, ax=ax, nodelist=nodelist, edgelist=edgelist, **kwargs)


def draw_embedding(G, layout, emb, embedded_graph=None, interaction_edges=None,
Expand Down

0 comments on commit 0ccb583

Please sign in to comment.