Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drawing warning #512

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions xgi/drawing/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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.")
Expand Down
Loading