Skip to content

Commit

Permalink
Fix drawing warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlandry committed Feb 20, 2024
1 parent 1e746bf commit 7d3b5aa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xgi/drawing/draw.py
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
import numpy as np
import seaborn as sb # for cmap "crest"
from matplotlib import cm
from matplotlib.colors import is_color_like
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d.art3d import (
Line3DCollection,
@@ -433,10 +434,6 @@ def draw_nodes(
settings.update(params)
settings.update(kwargs)

# avoid matplotlib scatter UserWarning "Parameters 'cmap' will be ignored"
if isinstance(node_fc, str):
node_fc_cmap = None

ax, pos = _draw_init(H, ax, pos)

# convert pos to format convenient for scatter
@@ -450,6 +447,12 @@ def draw_nodes(
node_fc = _draw_arg_to_arr(node_fc)
node_lw = _draw_arg_to_arr(node_lw)

# avoid matplotlib scatter UserWarning "Parameters 'cmap' will be ignored"
if isinstance(node_fc, str) or (
isinstance(node_fc, np.ndarray) and is_color_like(node_fc[0])
):
node_fc_cmap = None

# check validity of input values
if np.any(node_size < 0):
raise ValueError("node_size cannot contain negative values.")

0 comments on commit 7d3b5aa

Please sign in to comment.