66import matplotlib as mpl
77import matplotlib .pyplot as plt
88import numpy as np
9- import seaborn as sb # This cannot be removed because it is used for cmap "crest"
109from matplotlib import cm
1110from matplotlib .colors import is_color_like
1211from matplotlib .patches import FancyArrowPatch
2524from ..convert import to_bipartite_edgelist
2625from ..core import DiHypergraph , Hypergraph , SimplicialComplex
2726from ..exception import XGIError
28- from ..utils import subfaces
27+ from ..utils import crest_r , subfaces
2928from .draw_utils import (
3029 _CCW_sort ,
3130 _draw_arg_to_arr ,
@@ -70,7 +69,7 @@ def draw(
7069 dyad_vmin = None ,
7170 dyad_vmax = None ,
7271 edge_fc = None ,
73- edge_fc_cmap = " crest_r" ,
72+ edge_fc_cmap = crest_r () ,
7473 edge_vmin = None ,
7574 edge_vmax = None ,
7675 edge_ec = None ,
@@ -298,7 +297,6 @@ def draw(
298297 )
299298
300299 elif isinstance (H , Hypergraph ):
301-
302300 ax , (dyad_collection , edge_collection ) = draw_hyperedges (
303301 H = H ,
304302 pos = pos ,
@@ -510,8 +508,8 @@ def draw_nodes(
510508
511509 # plot
512510 node_collection = ax .scatter (
513- x = xy [:, 0 ],
514- y = xy [:, 1 ],
511+ xy [:, 0 ],
512+ xy [:, 1 ],
515513 s = node_size ,
516514 marker = node_shape ,
517515 c = node_fc ,
@@ -552,7 +550,7 @@ def draw_hyperedges(
552550 dyad_vmin = None ,
553551 dyad_vmax = None ,
554552 edge_fc = None ,
555- edge_fc_cmap = " crest_r" ,
553+ edge_fc_cmap = crest_r () ,
556554 edge_vmin = None ,
557555 edge_vmax = None ,
558556 edge_ec = None ,
@@ -614,7 +612,7 @@ def draw_hyperedges(
614612
615613 If None (default), color by edge size.
616614 edge_fc_cmap: matplotlib colormap
617- Colormap used to map the edge colors. By default, " crest_r" .
615+ Colormap used to map the edge colors. By default, crest_r() .
618616 edge_vmin, edge_vmax : float, optional
619617 Minimum and maximum for edge colormap scaling. By default, None.
620618 edge_ec : color or list of colors or array-like or dict or EdgeStat, optional
@@ -775,7 +773,6 @@ def draw_hyperedges(
775773 edge_ec = edge_ec [ids_sorted ] if len (edge_ec ) > 1 else edge_ec # reorder
776774
777775 if edge_ec_to_map : # edgecolors need to be manually mapped
778-
779776 # create scalarmappable to map floats to colors
780777 # we use the same vmin, vmax, and cmap as for edge_fc
781778 norm = mpl .colors .Normalize (vmin = edge_vmin , vmax = edge_vmax )
@@ -849,7 +846,7 @@ def draw_simplices(
849846 dyad_vmin = None ,
850847 dyad_vmax = None ,
851848 edge_fc = None ,
852- edge_fc_cmap = " crest_r" ,
849+ edge_fc_cmap = crest_r () ,
853850 edge_vmin = None ,
854851 edge_vmax = None ,
855852 alpha = 0.4 ,
@@ -908,7 +905,7 @@ def draw_simplices(
908905
909906 If None (default), color by edge size.
910907 edge_fc_cmap: matplotlib colormap
911- Colormap used to map the edge colors. By default, " crest_r" .
908+ Colormap used to map the edge colors. By default, crest_r() .
912909 edge_vmin, edge_vmax : float, optional
913910 Minimum and maximum for edge colormap scaling. By default, None.
914911 alpha : float, optional
@@ -1259,12 +1256,12 @@ def draw_multilayer(
12591256 dyad_lw = 1.5 ,
12601257 dyad_style = "solid" ,
12611258 edge_fc = None ,
1262- edge_fc_cmap = " crest_r" ,
1259+ edge_fc_cmap = crest_r () ,
12631260 edge_vmin = None ,
12641261 edge_vmax = None ,
12651262 alpha = 0.4 ,
12661263 layer_color = "grey" ,
1267- layer_cmap = " crest_r" ,
1264+ layer_cmap = crest_r () ,
12681265 max_order = None ,
12691266 conn_lines = True ,
12701267 conn_lines_style = "dotted" ,
@@ -1347,7 +1344,7 @@ def draw_multilayer(
13471344
13481345 If None (default), color by edge size.
13491346 edge_fc_cmap: matplotlib colormap, optional
1350- Colormap used to map the edge colors. By default, " crest_r" .
1347+ Colormap used to map the edge colors. By default, crest_r() .
13511348 edge_vmin, edge_vmax : float, optional
13521349 Minimum and maximum for edge colormap scaling. By default, None.
13531350 alpha : float, optional
@@ -1356,7 +1353,7 @@ def draw_multilayer(
13561353 Color of layers. By default, "grey".
13571354 layer_cmap : colormap, optional
13581355 Colormap to use in case of numerical values in layer_color. Ignored if layer_color
1359- does not contain numerical values to be mapped. By default, " crest_r" , but ignored.
1356+ does not contain numerical values to be mapped. By default, crest_r() , but ignored.
13601357 max_order : int, optional
13611358 Maximum of hyperedges to plot. If None (default), plots all orders.
13621359 conn_lines : bool, optional
@@ -1485,7 +1482,6 @@ def draw_multilayer(
14851482
14861483 # plot layers
14871484 for jj , d in enumerate (orders ):
1488-
14891485 z = [sep * d ] * H .num_nodes
14901486
14911487 # draw surfaces corresponding to the different orders
@@ -1585,7 +1581,6 @@ def draw_multilayer(
15851581
15861582 # draw nodes (last)
15871583 for d in orders :
1588-
15891584 z = [sep * d ] * H .num_nodes
15901585
15911586 node_collection = ax .scatter (
@@ -1629,12 +1624,12 @@ def draw_bipartite(
16291624 edge_marker_lw = 1 ,
16301625 edge_marker_size = 7 ,
16311626 edge_marker_shape = "s" ,
1632- edge_marker_fc_cmap = " crest_r" ,
1627+ edge_marker_fc_cmap = crest_r () ,
16331628 max_order = None ,
16341629 dyad_color = None ,
16351630 dyad_lw = 1 ,
16361631 dyad_style = "solid" ,
1637- dyad_color_cmap = " crest_r" ,
1632+ dyad_color_cmap = crest_r () ,
16381633 node_labels = None ,
16391634 hyperedge_labels = None ,
16401635 arrowsize = 10 ,
@@ -1952,7 +1947,7 @@ def draw_undirected_dyads(
19521947 dyad_color = None ,
19531948 dyad_lw = 1 ,
19541949 dyad_style = "solid" ,
1955- dyad_color_cmap = " crest_r" ,
1950+ dyad_color_cmap = crest_r () ,
19561951 rescale_sizes = True ,
19571952 ** kwargs ,
19581953):
@@ -2114,7 +2109,7 @@ def draw_directed_dyads(
21142109 dyad_color = None ,
21152110 dyad_lw = 1 ,
21162111 dyad_style = "solid" ,
2117- dyad_color_cmap = " crest_r" ,
2112+ dyad_color_cmap = crest_r () ,
21182113 arrowsize = 10 ,
21192114 arrowstyle = "->" ,
21202115 connectionstyle = "arc3" ,
@@ -2336,7 +2331,6 @@ def to_marker_edge(marker_size, marker):
23362331 ems = edge_marker_size
23372332
23382333 for n in tail : # lines going towards the center
2339-
23402334 xy_source = node_pos [n ]
23412335 xy_target = edge_pos [e ]
23422336
0 commit comments