From 610f9c9bbc264f90152de9d569cc60eb90b388fc Mon Sep 17 00:00:00 2001 From: Maxime Lucas Date: Sun, 1 Sep 2024 22:52:20 +0100 Subject: [PATCH] style: black --- docs/source/conf.py | 7 ++++--- tests/drawing/test_draw.py | 18 +++++++++++------- xgi/drawing/draw.py | 13 ++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 577d8a93..64f6a05d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -160,7 +160,10 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - "navbar_end": ["theme-switcher", "navbar-icon-links"], # Place the social links at the end of the navbar + "navbar_end": [ + "theme-switcher", + "navbar-icon-links", + ], # Place the social links at the end of the navbar "icon_links": [ { "name": "GitHub", @@ -181,8 +184,6 @@ } - - html_sidebars = { "**": ["sidebar-nav-bs", "sidebar-ethical-ads"], "index": [], diff --git a/tests/drawing/test_draw.py b/tests/drawing/test_draw.py index 4eadd158..6edc1e78 100644 --- a/tests/drawing/test_draw.py +++ b/tests/drawing/test_draw.py @@ -340,16 +340,20 @@ def test_draw_hyperedges_ec(edgelist8): H = xgi.Hypergraph(edgelist8) - colors = np.array([[0.6468274 , 0.80289262, 0.56592265, 0.4], - [0.17363177, 0.19076859, 0.44549087, 0.4], - [0.17363177, 0.19076859, 0.44549087, 0.4], - [0.17363177, 0.19076859, 0.44549087, 0.4], - [0.17363177, 0.19076859, 0.44549087, 0.4], - [0.17363177, 0.19076859, 0.44549087, 0.4]]) + colors = np.array( + [ + [0.6468274, 0.80289262, 0.56592265, 0.4], + [0.17363177, 0.19076859, 0.44549087, 0.4], + [0.17363177, 0.19076859, 0.44549087, 0.4], + [0.17363177, 0.19076859, 0.44549087, 0.4], + [0.17363177, 0.19076859, 0.44549087, 0.4], + [0.17363177, 0.19076859, 0.44549087, 0.4], + ] + ) # edge stat color fig, ax = plt.subplots() - ax, collections = xgi.draw_hyperedges(H,ax=ax, edge_ec=H.edges.size, edge_fc="w") + ax, collections = xgi.draw_hyperedges(H, ax=ax, edge_ec=H.edges.size, edge_fc="w") (_, edge_collection) = collections assert np.all(edge_collection.get_edgecolor() == colors) diff --git a/xgi/drawing/draw.py b/xgi/drawing/draw.py index b6a18ff2..c1bf5045 100644 --- a/xgi/drawing/draw.py +++ b/xgi/drawing/draw.py @@ -182,7 +182,7 @@ def draw( * IDStat containing the `ids` as keys If None (default), color by edge size. - Numerical formats will be mapped to colors using edge_vmin, edge_vmax, + Numerical formats will be mapped to colors using edge_vmin, edge_vmax, and edge_fc_cmap. alpha : float, optional The edge transparency. By default, 0.4. @@ -618,7 +618,7 @@ def draw_hyperedges( * IDStat containing the `ids` as keys If None (default), color by edge size. - Numerical formats will be mapped to colors using edge_vmin, edge_vmax, + Numerical formats will be mapped to colors using edge_vmin, edge_vmax, and edge_fc_cmap. alpha : float, optional The edge transparency. By default, 0.4. @@ -752,17 +752,16 @@ def draw_hyperedges( edge_fc_arr = None edge_fc_colors = edge_fc[ids_sorted] if len(edge_fc) > 1 else edge_fc - - edge_ec = edge_ec[ids_sorted] if len(edge_ec) > 1 else edge_ec # reorder + edge_ec = edge_ec[ids_sorted] if len(edge_ec) > 1 else edge_ec # reorder - if edge_ec_to_map: # edgecolors need to be manually mapped + if edge_ec_to_map: # edgecolors need to be manually mapped # create scalarmappable to map floats to colors # we use the same vmin, vmax, and cmap as for edge_fc norm = mpl.colors.Normalize(vmin=edge_vmin, vmax=edge_vmax) sm_edgecolors = cm.ScalarMappable(norm=norm, cmap=edge_fc_cmap) - edge_ec = sm_edgecolors.to_rgba(edge_ec) # map to colors + edge_ec = sm_edgecolors.to_rgba(edge_ec) # map to colors patches = [] for he in np.array(edges.members())[ids_sorted]: @@ -790,7 +789,7 @@ def draw_hyperedges( edge_collection = PatchCollection( patches, facecolors=edge_fc_colors, - array=edge_fc_arr, # will be mapped by PatchCollection + array=edge_fc_arr, # will be mapped by PatchCollection cmap=edge_fc_cmap, edgecolors=edge_ec, alpha=alpha,