Repository: xgi-org/xgi

Issue:
Fix warning in `draw_multilayer`
I get the error `UserWarning: No data for colormapping provided via 'c'` when using `draw_multilayer`. Similar to #499.

Discussion:
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/xgi-org/xgi/pull/517?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=xgi-org) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 92.04%. Comparing base [(`0f6b389`)](https://app.codecov.io/gh/xgi-org/xgi/commit/0f6b389a734a6f9b723d7b2a2979b0f621a6c72d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=xgi-org) to head [(`dbdfee7`)](https://app.codecov.io/gh/xgi-org/xgi/pull/517?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=xgi-org).


<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #517   +/-   ##
=======================================
  Coverage   92.03%   92.04%           
=======================================
  Files          60       60           
  Lines        4370     4372    +2     
=======================================
+ Hits         4022     4024    +2     
  Misses        348      348           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/xgi-org/xgi/pull/517?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=xgi-org).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=xgi-org).


Patch:
diff --git a/xgi/drawing/draw.py b/xgi/drawing/draw.py
index 09dfe5d..66cfe1e 100644
--- a/xgi/drawing/draw.py
+++ b/xgi/drawing/draw.py
@@ -1342,6 +1342,12 @@ def draw_multilayer(
     dyad_lw = _draw_arg_to_arr(dyad_lw)
     layer_color = _draw_arg_to_arr(layer_color)
 
+    # 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.")


Test patch:
diff --git a/tests/drawing/test_draw.py b/tests/drawing/test_draw.py
index c31d8e0..8900b00 100644
--- a/tests/drawing/test_draw.py
+++ b/tests/drawing/test_draw.py
@@ -639,3 +639,17 @@ def test_issue_499(edgelist8):
         ax, collections = xgi.draw(H, ax=ax, node_fc=["black"] * H.num_nodes)
 
     plt.close("all")
+
+
+def test_issue_515(edgelist8):
+    H = xgi.Hypergraph(edgelist8)
+
+    with warnings.catch_warnings():
+        warnings.simplefilter("error")
+        ax, (node_coll, edge_coll) = xgi.draw_multilayer(H, node_fc="black")
+
+    with warnings.catch_warnings():
+        warnings.simplefilter("error")
+        ax, (node_coll, edge_coll) = xgi.draw_multilayer(H, node_fc=["black"] * H.num_nodes)
+
+    plt.close("all")