risk-network 0.0.8b5__py3-none-any.whl → 0.0.8b6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- risk/__init__.py +1 -1
- risk/network/plot.py +80 -52
- {risk_network-0.0.8b5.dist-info → risk_network-0.0.8b6.dist-info}/METADATA +1 -1
- {risk_network-0.0.8b5.dist-info → risk_network-0.0.8b6.dist-info}/RECORD +7 -7
- {risk_network-0.0.8b5.dist-info → risk_network-0.0.8b6.dist-info}/LICENSE +0 -0
- {risk_network-0.0.8b5.dist-info → risk_network-0.0.8b6.dist-info}/WHEEL +0 -0
- {risk_network-0.0.8b5.dist-info → risk_network-0.0.8b6.dist-info}/top_level.txt +0 -0
risk/__init__.py
CHANGED
risk/network/plot.py
CHANGED
@@ -33,7 +33,7 @@ class NetworkPlotter:
|
|
33
33
|
graph: NetworkGraph,
|
34
34
|
figsize: Tuple = (10, 10),
|
35
35
|
background_color: Union[str, List, Tuple, np.ndarray] = "white",
|
36
|
-
background_alpha: float = 1.0,
|
36
|
+
background_alpha: Union[float, None] = 1.0,
|
37
37
|
) -> None:
|
38
38
|
"""Initialize the NetworkPlotter with a NetworkGraph object and plotting parameters.
|
39
39
|
|
@@ -41,7 +41,8 @@ class NetworkPlotter:
|
|
41
41
|
graph (NetworkGraph): The network data and attributes to be visualized.
|
42
42
|
figsize (tuple, optional): Size of the figure in inches (width, height). Defaults to (10, 10).
|
43
43
|
background_color (str, list, tuple, np.ndarray, optional): Background color of the plot. Defaults to "white".
|
44
|
-
background_alpha (float, optional): Transparency level of the background color.
|
44
|
+
background_alpha (float, None, optional): Transparency level of the background color. If provided, it overrides
|
45
|
+
any existing alpha values found in background_color. Defaults to 1.0.
|
45
46
|
"""
|
46
47
|
self.graph = graph
|
47
48
|
# Initialize the plot with the specified parameters
|
@@ -57,7 +58,7 @@ class NetworkPlotter:
|
|
57
58
|
graph: NetworkGraph,
|
58
59
|
figsize: Tuple,
|
59
60
|
background_color: Union[str, List, Tuple, np.ndarray],
|
60
|
-
background_alpha: float
|
61
|
+
background_alpha: Union[float, None],
|
61
62
|
) -> plt.Axes:
|
62
63
|
"""Set up the plot with figure size and background color.
|
63
64
|
|
@@ -65,7 +66,8 @@ class NetworkPlotter:
|
|
65
66
|
graph (NetworkGraph): The network data and attributes to be visualized.
|
66
67
|
figsize (tuple): Size of the figure in inches (width, height).
|
67
68
|
background_color (str): Background color of the plot.
|
68
|
-
background_alpha (float, optional): Transparency level of the background color.
|
69
|
+
background_alpha (float, None, optional): Transparency level of the background color. If provided, it overrides any
|
70
|
+
existing alpha values found in background_color.
|
69
71
|
|
70
72
|
Returns:
|
71
73
|
plt.Axes: The axis object for the plot.
|
@@ -181,8 +183,8 @@ class NetworkPlotter:
|
|
181
183
|
linestyle: str = "dashed",
|
182
184
|
linewidth: float = 1.5,
|
183
185
|
color: Union[str, List, Tuple, np.ndarray] = "black",
|
184
|
-
outline_alpha: float = 1.0,
|
185
|
-
fill_alpha: float = 0.0,
|
186
|
+
outline_alpha: Union[float, None] = 1.0,
|
187
|
+
fill_alpha: Union[float, None] = 0.0,
|
186
188
|
) -> None:
|
187
189
|
"""Plot a circle around the network graph to represent the network perimeter.
|
188
190
|
|
@@ -191,8 +193,10 @@ class NetworkPlotter:
|
|
191
193
|
linestyle (str, optional): Line style for the network perimeter circle (e.g., dashed, solid). Defaults to "dashed".
|
192
194
|
linewidth (float, optional): Width of the circle's outline. Defaults to 1.5.
|
193
195
|
color (str, list, tuple, or np.ndarray, optional): Color of the network perimeter circle. Defaults to "black".
|
194
|
-
outline_alpha (float, optional): Transparency level of the circle outline.
|
195
|
-
|
196
|
+
outline_alpha (float, None, optional): Transparency level of the circle outline. If provided, it overrides any existing alpha
|
197
|
+
values found in color. Defaults to 1.0.
|
198
|
+
fill_alpha (float, None, optional): Transparency level of the circle fill. If provided, it overrides any existing alpha values
|
199
|
+
found in color. Defaults to 0.0.
|
196
200
|
"""
|
197
201
|
# Log the circle perimeter plotting parameters
|
198
202
|
params.log_plotter(
|
@@ -240,8 +244,8 @@ class NetworkPlotter:
|
|
240
244
|
color: Union[str, List, Tuple, np.ndarray] = "black",
|
241
245
|
linestyle: str = "solid",
|
242
246
|
linewidth: float = 1.5,
|
243
|
-
outline_alpha: float = 1.0,
|
244
|
-
fill_alpha: float = 0.0,
|
247
|
+
outline_alpha: Union[float, None] = 1.0,
|
248
|
+
fill_alpha: Union[float, None] = 0.0,
|
245
249
|
) -> None:
|
246
250
|
"""
|
247
251
|
Plot a KDE-based contour around the network graph to represent the network perimeter.
|
@@ -254,8 +258,10 @@ class NetworkPlotter:
|
|
254
258
|
color (str, list, tuple, or np.ndarray, optional): Color of the network perimeter contour. Defaults to "black".
|
255
259
|
linestyle (str, optional): Line style for the network perimeter contour (e.g., dashed, solid). Defaults to "solid".
|
256
260
|
linewidth (float, optional): Width of the contour's outline. Defaults to 1.5.
|
257
|
-
outline_alpha (float, optional): Transparency level of the contour outline.
|
258
|
-
|
261
|
+
outline_alpha (float, None, optional): Transparency level of the contour outline. If provided, it overrides any existing
|
262
|
+
alpha values found in color. Defaults to 1.0.
|
263
|
+
fill_alpha (float, None, optional): Transparency level of the contour fill. If provided, it overrides any existing alpha
|
264
|
+
values found in color. Defaults to 0.0.
|
259
265
|
"""
|
260
266
|
# Log the contour perimeter plotting parameters
|
261
267
|
params.log_plotter(
|
@@ -300,8 +306,8 @@ class NetworkPlotter:
|
|
300
306
|
node_color: Union[str, List, Tuple, np.ndarray] = "white",
|
301
307
|
node_edgecolor: Union[str, List, Tuple, np.ndarray] = "black",
|
302
308
|
edge_color: Union[str, List, Tuple, np.ndarray] = "black",
|
303
|
-
node_alpha: float = 1.0,
|
304
|
-
edge_alpha: float = 1.0,
|
309
|
+
node_alpha: Union[float, None] = 1.0,
|
310
|
+
edge_alpha: Union[float, None] = 1.0,
|
305
311
|
) -> None:
|
306
312
|
"""Plot the network graph with customizable node colors, sizes, edge widths, and node edge widths.
|
307
313
|
|
@@ -310,11 +316,14 @@ class NetworkPlotter:
|
|
310
316
|
node_shape (str, optional): Shape of the nodes. Defaults to "o".
|
311
317
|
node_edgewidth (float, optional): Width of the node edges. Defaults to 1.0.
|
312
318
|
edge_width (float, optional): Width of the edges. Defaults to 1.0.
|
313
|
-
node_color (str, list, tuple, or np.ndarray, optional): Color of the nodes. Can be a single color or an array of colors.
|
319
|
+
node_color (str, list, tuple, or np.ndarray, optional): Color of the nodes. Can be a single color or an array of colors.
|
320
|
+
Defaults to "white".
|
314
321
|
node_edgecolor (str, list, tuple, or np.ndarray, optional): Color of the node edges. Defaults to "black".
|
315
322
|
edge_color (str, list, tuple, or np.ndarray, optional): Color of the edges. Defaults to "black".
|
316
|
-
node_alpha (float, optional): Alpha value (transparency) for the nodes.
|
317
|
-
|
323
|
+
node_alpha (float, None, optional): Alpha value (transparency) for the nodes. If provided, it overrides any existing alpha
|
324
|
+
values found in node_color. Defaults to 1.0. Annotated node_color alphas will override this value.
|
325
|
+
edge_alpha (float, None, optional): Alpha value (transparency) for the edges. If provided, it overrides any existing alpha
|
326
|
+
values found in edge_color. Defaults to 1.0.
|
318
327
|
"""
|
319
328
|
# Log the plotting parameters
|
320
329
|
params.log_plotter(
|
@@ -378,8 +387,8 @@ class NetworkPlotter:
|
|
378
387
|
node_color: Union[str, List, Tuple, np.ndarray] = "white",
|
379
388
|
node_edgecolor: Union[str, List, Tuple, np.ndarray] = "black",
|
380
389
|
edge_color: Union[str, List, Tuple, np.ndarray] = "black",
|
381
|
-
node_alpha: float =
|
382
|
-
edge_alpha: float =
|
390
|
+
node_alpha: Union[float, None] = None,
|
391
|
+
edge_alpha: Union[float, None] = None,
|
383
392
|
) -> None:
|
384
393
|
"""Plot a subnetwork of selected nodes with customizable node and edge attributes.
|
385
394
|
|
@@ -392,8 +401,10 @@ class NetworkPlotter:
|
|
392
401
|
node_color (str, list, tuple, or np.ndarray, optional): Color of the nodes. Defaults to "white".
|
393
402
|
node_edgecolor (str, list, tuple, or np.ndarray, optional): Color of the node edges. Defaults to "black".
|
394
403
|
edge_color (str, list, tuple, or np.ndarray, optional): Color of the edges. Defaults to "black".
|
395
|
-
node_alpha (float, optional): Transparency for the nodes.
|
396
|
-
|
404
|
+
node_alpha (float, None, optional): Transparency for the nodes. If provided, it overrides any existing alpha values
|
405
|
+
found in node_color. Defaults to 1.0.
|
406
|
+
edge_alpha (float, None, optional): Transparency for the edges. If provided, it overrides any existing alpha values
|
407
|
+
found in node_color. Defaults to 1.0.
|
397
408
|
|
398
409
|
Raises:
|
399
410
|
ValueError: If no valid nodes are found in the network graph.
|
@@ -459,8 +470,8 @@ class NetworkPlotter:
|
|
459
470
|
color: Union[str, List, Tuple, np.ndarray] = "white",
|
460
471
|
linestyle: str = "solid",
|
461
472
|
linewidth: float = 1.5,
|
462
|
-
alpha: float = 1.0,
|
463
|
-
fill_alpha: float =
|
473
|
+
alpha: Union[float, None] = 1.0,
|
474
|
+
fill_alpha: Union[float, None] = None,
|
464
475
|
) -> None:
|
465
476
|
"""Draw KDE contours for nodes in various domains of a network graph, highlighting areas of high density.
|
466
477
|
|
@@ -468,11 +479,14 @@ class NetworkPlotter:
|
|
468
479
|
levels (int, optional): Number of contour levels to plot. Defaults to 5.
|
469
480
|
bandwidth (float, optional): Bandwidth for KDE. Controls the smoothness of the contour. Defaults to 0.8.
|
470
481
|
grid_size (int, optional): Resolution of the grid for KDE. Higher values create finer contours. Defaults to 250.
|
471
|
-
color (str, list, tuple, or np.ndarray, optional): Color of the contours. Can be a single color or an array of colors.
|
482
|
+
color (str, list, tuple, or np.ndarray, optional): Color of the contours. Can be a single color or an array of colors.
|
483
|
+
Defaults to "white".
|
472
484
|
linestyle (str, optional): Line style for the contours. Defaults to "solid".
|
473
485
|
linewidth (float, optional): Line width for the contours. Defaults to 1.5.
|
474
|
-
alpha (float, optional): Transparency level of the contour lines.
|
475
|
-
|
486
|
+
alpha (float, None, optional): Transparency level of the contour lines. If provided, it overrides any existing alpha values
|
487
|
+
found in color. Defaults to 1.0.
|
488
|
+
fill_alpha (float, None, optional): Transparency level of the contour fill. If provided, it overrides any existing alpha
|
489
|
+
values found in color. Defaults to None.
|
476
490
|
"""
|
477
491
|
# Log the contour plotting parameters
|
478
492
|
params.log_plotter(
|
@@ -518,8 +532,8 @@ class NetworkPlotter:
|
|
518
532
|
color: Union[str, List, Tuple, np.ndarray] = "white",
|
519
533
|
linestyle: str = "solid",
|
520
534
|
linewidth: float = 1.5,
|
521
|
-
alpha: float = 1.0,
|
522
|
-
fill_alpha: float =
|
535
|
+
alpha: Union[float, None] = 1.0,
|
536
|
+
fill_alpha: Union[float, None] = None,
|
523
537
|
) -> None:
|
524
538
|
"""Plot a subcontour for a given set of nodes or a list of node sets using Kernel Density Estimation (KDE).
|
525
539
|
|
@@ -528,11 +542,14 @@ class NetworkPlotter:
|
|
528
542
|
levels (int, optional): Number of contour levels to plot. Defaults to 5.
|
529
543
|
bandwidth (float, optional): Bandwidth for KDE. Controls the smoothness of the contour. Defaults to 0.8.
|
530
544
|
grid_size (int, optional): Resolution of the grid for KDE. Higher values create finer contours. Defaults to 250.
|
531
|
-
color (str, list, tuple, or np.ndarray, optional): Color of the contour. Can be a string (e.g., 'white') or RGBA array.
|
545
|
+
color (str, list, tuple, or np.ndarray, optional): Color of the contour. Can be a string (e.g., 'white') or RGBA array.
|
546
|
+
Defaults to "white".
|
532
547
|
linestyle (str, optional): Line style for the contour. Defaults to "solid".
|
533
548
|
linewidth (float, optional): Line width for the contour. Defaults to 1.5.
|
534
|
-
alpha (float, optional): Transparency level of the contour lines.
|
535
|
-
|
549
|
+
alpha (float, None, optional): Transparency level of the contour lines. If provided, it overrides any existing alpha values
|
550
|
+
found in color. Defaults to 1.0.
|
551
|
+
fill_alpha (float, None, optional): Transparency level of the contour fill. If provided, it overrides any existing alpha
|
552
|
+
values found in color. Defaults to None.
|
536
553
|
|
537
554
|
Raises:
|
538
555
|
ValueError: If no valid nodes are found in the network graph.
|
@@ -588,8 +605,8 @@ class NetworkPlotter:
|
|
588
605
|
color: Union[str, np.ndarray] = "white",
|
589
606
|
linestyle: str = "solid",
|
590
607
|
linewidth: float = 1.5,
|
591
|
-
alpha: float = 1.0,
|
592
|
-
fill_alpha: float = 0.2,
|
608
|
+
alpha: Union[float, None] = 1.0,
|
609
|
+
fill_alpha: Union[float, None] = 0.2,
|
593
610
|
) -> None:
|
594
611
|
"""Draw a Kernel Density Estimate (KDE) contour plot for a set of nodes on a given axis.
|
595
612
|
|
@@ -603,8 +620,10 @@ class NetworkPlotter:
|
|
603
620
|
color (str or np.ndarray): Color for the contour. Can be a string or RGBA array. Defaults to "white".
|
604
621
|
linestyle (str, optional): Line style for the contour. Defaults to "solid".
|
605
622
|
linewidth (float, optional): Line width for the contour. Defaults to 1.5.
|
606
|
-
alpha (float, optional): Transparency level for the contour lines.
|
607
|
-
|
623
|
+
alpha (float, None, optional): Transparency level for the contour lines. If provided, it overrides any existing alpha
|
624
|
+
values found in color. Defaults to 1.0.
|
625
|
+
fill_alpha (float, None, optional): Transparency level for the contour fill. If provided, it overrides any existing
|
626
|
+
alpha values found in color. Defaults to 0.2.
|
608
627
|
"""
|
609
628
|
# Extract the positions of the specified nodes
|
610
629
|
points = np.array([pos[n] for n in nodes])
|
@@ -691,11 +710,11 @@ class NetworkPlotter:
|
|
691
710
|
font: str = "Arial",
|
692
711
|
fontsize: int = 10,
|
693
712
|
fontcolor: Union[str, List, Tuple, np.ndarray] = "black",
|
694
|
-
fontalpha: float = 1.0,
|
713
|
+
fontalpha: Union[float, None] = 1.0,
|
695
714
|
arrow_linewidth: float = 1,
|
696
715
|
arrow_style: str = "->",
|
697
716
|
arrow_color: Union[str, List, Tuple, np.ndarray] = "black",
|
698
|
-
arrow_alpha: float = 1.0,
|
717
|
+
arrow_alpha: Union[float, None] = 1.0,
|
699
718
|
arrow_base_shrink: float = 0.0,
|
700
719
|
arrow_tip_shrink: float = 0.0,
|
701
720
|
max_labels: Union[int, None] = None,
|
@@ -715,12 +734,15 @@ class NetworkPlotter:
|
|
715
734
|
offset (float, optional): Offset distance for labels from the perimeter. Defaults to 0.10.
|
716
735
|
font (str, optional): Font name for the labels. Defaults to "Arial".
|
717
736
|
fontsize (int, optional): Font size for the labels. Defaults to 10.
|
718
|
-
fontcolor (str, list, tuple, or np.ndarray, optional): Color of the label text. Can be a string or RGBA array.
|
719
|
-
|
737
|
+
fontcolor (str, list, tuple, or np.ndarray, optional): Color of the label text. Can be a string or RGBA array.
|
738
|
+
Defaults to "black".
|
739
|
+
fontalpha (float, None, optional): Transparency level for the font color. If provided, it overrides any existing alpha
|
740
|
+
values found in fontcolor. Defaults to 1.0.
|
720
741
|
arrow_linewidth (float, optional): Line width of the arrows pointing to centroids. Defaults to 1.
|
721
742
|
arrow_style (str, optional): Style of the arrows pointing to centroids. Defaults to "->".
|
722
743
|
arrow_color (str, list, tuple, or np.ndarray, optional): Color of the arrows. Defaults to "black".
|
723
|
-
arrow_alpha (float, optional): Transparency level for the arrow color.
|
744
|
+
arrow_alpha (float, None, optional): Transparency level for the arrow color. If provided, it overrides any existing alpha
|
745
|
+
values found in arrow_color. Defaults to 1.0.
|
724
746
|
arrow_base_shrink (float, optional): Distance between the text and the base of the arrow. Defaults to 0.0.
|
725
747
|
arrow_tip_shrink (float, optional): Distance between the arrow tip and the centroid. Defaults to 0.0.
|
726
748
|
max_labels (int, optional): Maximum number of labels to plot. Defaults to None (no limit).
|
@@ -732,9 +754,9 @@ class NetworkPlotter:
|
|
732
754
|
overlay_ids (bool, optional): Whether to overlay domain IDs in the center of the centroids. Defaults to False.
|
733
755
|
ids_to_keep (list, tuple, np.ndarray, or None, optional): IDs of domains that must be labeled. To discover domain IDs,
|
734
756
|
you can set `overlay_ids=True`. Defaults to None.
|
735
|
-
ids_to_replace (dict, optional): A dictionary mapping domain IDs to custom labels (strings). The labels should be
|
736
|
-
If provided, the custom labels will replace the default domain terms. To discover domain IDs, you
|
737
|
-
Defaults to None.
|
757
|
+
ids_to_replace (dict, optional): A dictionary mapping domain IDs to custom labels (strings). The labels should be
|
758
|
+
space-separated words. If provided, the custom labels will replace the default domain terms. To discover domain IDs, you
|
759
|
+
can set `overlay_ids=True`. Defaults to None.
|
738
760
|
|
739
761
|
Raises:
|
740
762
|
ValueError: If the number of provided `ids_to_keep` exceeds `max_labels`.
|
@@ -895,11 +917,11 @@ class NetworkPlotter:
|
|
895
917
|
font: str = "Arial",
|
896
918
|
fontsize: int = 10,
|
897
919
|
fontcolor: Union[str, List, Tuple, np.ndarray] = "black",
|
898
|
-
fontalpha: float = 1.0,
|
920
|
+
fontalpha: Union[float, None] = 1.0,
|
899
921
|
arrow_linewidth: float = 1,
|
900
922
|
arrow_style: str = "->",
|
901
923
|
arrow_color: Union[str, List, Tuple, np.ndarray] = "black",
|
902
|
-
arrow_alpha: float = 1.0,
|
924
|
+
arrow_alpha: Union[float, None] = 1.0,
|
903
925
|
arrow_base_shrink: float = 0.0,
|
904
926
|
arrow_tip_shrink: float = 0.0,
|
905
927
|
) -> None:
|
@@ -914,11 +936,13 @@ class NetworkPlotter:
|
|
914
936
|
font (str, optional): Font name for the label. Defaults to "Arial".
|
915
937
|
fontsize (int, optional): Font size for the label. Defaults to 10.
|
916
938
|
fontcolor (str, list, tuple, or np.ndarray, optional): Color of the label text. Defaults to "black".
|
917
|
-
fontalpha (float, optional): Transparency level for the font color.
|
939
|
+
fontalpha (float, None, optional): Transparency level for the font color. If provided, it overrides any existing alpha values found
|
940
|
+
in fontalpha. Defaults to 1.0.
|
918
941
|
arrow_linewidth (float, optional): Line width of the arrow pointing to the centroid. Defaults to 1.
|
919
942
|
arrow_style (str, optional): Style of the arrows pointing to the centroid. Defaults to "->".
|
920
943
|
arrow_color (str, list, tuple, or np.ndarray, optional): Color of the arrow. Defaults to "black".
|
921
|
-
arrow_alpha (float, optional): Transparency level for the arrow color.
|
944
|
+
arrow_alpha (float, None, optional): Transparency level for the arrow color. If provided, it overrides any existing alpha values
|
945
|
+
found in arrow_alpha. Defaults to 1.0.
|
922
946
|
arrow_base_shrink (float, optional): Distance between the text and the base of the arrow. Defaults to 0.0.
|
923
947
|
arrow_tip_shrink (float, optional): Distance between the arrow tip and the centroid. Defaults to 0.0.
|
924
948
|
"""
|
@@ -1275,9 +1299,9 @@ class NetworkPlotter:
|
|
1275
1299
|
min_scale: float = 0.8,
|
1276
1300
|
max_scale: float = 1.0,
|
1277
1301
|
scale_factor: float = 1.0,
|
1278
|
-
alpha: float = 1.0,
|
1302
|
+
alpha: Union[float, None] = 1.0,
|
1279
1303
|
nonenriched_color: Union[str, List, Tuple, np.ndarray] = "white",
|
1280
|
-
nonenriched_alpha: float = 1.0,
|
1304
|
+
nonenriched_alpha: Union[float, None] = 1.0,
|
1281
1305
|
random_seed: int = 888,
|
1282
1306
|
) -> np.ndarray:
|
1283
1307
|
"""Adjust the colors of nodes in the network graph based on enrichment.
|
@@ -1288,9 +1312,11 @@ class NetworkPlotter:
|
|
1288
1312
|
min_scale (float, optional): Minimum scale for color intensity. Defaults to 0.8.
|
1289
1313
|
max_scale (float, optional): Maximum scale for color intensity. Defaults to 1.0.
|
1290
1314
|
scale_factor (float, optional): Factor for adjusting the color scaling intensity. Defaults to 1.0.
|
1291
|
-
alpha (float, optional): Alpha value for enriched nodes.
|
1315
|
+
alpha (float, None, optional): Alpha value for enriched nodes. If provided, it overrides any existing alpha values
|
1316
|
+
found in color. Defaults to 1.0.
|
1292
1317
|
nonenriched_color (str, list, tuple, or np.ndarray, optional): Color for non-enriched nodes. Defaults to "white".
|
1293
|
-
nonenriched_alpha (float, optional): Alpha value for non-enriched nodes.
|
1318
|
+
nonenriched_alpha (float, None, optional): Alpha value for non-enriched nodes. If provided, it overrides any existing
|
1319
|
+
alpha values found in nonenriched_color. Defaults to 1.0.
|
1294
1320
|
random_seed (int, optional): Seed for random number generation. Defaults to 888.
|
1295
1321
|
|
1296
1322
|
Returns:
|
@@ -1493,7 +1519,8 @@ def _to_rgba(
|
|
1493
1519
|
|
1494
1520
|
Args:
|
1495
1521
|
color (Union[str, list, tuple, np.ndarray]): The color(s) to convert. Can be a string, list, tuple, or np.ndarray.
|
1496
|
-
alpha (float, None, optional): Alpha value (transparency) to apply. If provided, it overrides any existing alpha values
|
1522
|
+
alpha (float, None, optional): Alpha value (transparency) to apply. If provided, it overrides any existing alpha values
|
1523
|
+
found in color.
|
1497
1524
|
num_repeats (int, None, optional): If provided, the color(s) will be repeated this many times. Defaults to None.
|
1498
1525
|
|
1499
1526
|
Returns:
|
@@ -1502,6 +1529,7 @@ def _to_rgba(
|
|
1502
1529
|
|
1503
1530
|
def convert_to_rgba(c: Union[str, List, Tuple, np.ndarray]) -> np.ndarray:
|
1504
1531
|
"""Convert a single color to RGBA format, handling strings, hex, and RGB/RGBA lists."""
|
1532
|
+
# Note: if no alpha is provided, the default alpha value is 1.0 by mcolors.to_rgba
|
1505
1533
|
if isinstance(c, str):
|
1506
1534
|
# Convert color names or hex values (e.g., 'red', '#FF5733') to RGBA
|
1507
1535
|
rgba = np.array(mcolors.to_rgba(c))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
risk/__init__.py,sha256=
|
1
|
+
risk/__init__.py,sha256=oTYQd6b81qD9V2lbuvkOnnilV22_-KXFOBGtoULd5Sc,112
|
2
2
|
risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
|
3
3
|
risk/risk.py,sha256=FaQhDCBZxZSAXJsScH0rSbjjCTNZA5vgf9rJj1GHW44,20924
|
4
4
|
risk/annotations/__init__.py,sha256=vUpVvMRE5if01Ic8QY6M2Ae3EFGJHdugEe9PdEkAW4Y,138
|
@@ -15,7 +15,7 @@ risk/network/__init__.py,sha256=iEPeJdZfqp0toxtbElryB8jbz9_t_k4QQ3iDvKE8C_0,126
|
|
15
15
|
risk/network/geometry.py,sha256=H1yGVVqgbfpzBzJwEheDLfvGLSA284jGQQTn612L4Vc,6759
|
16
16
|
risk/network/graph.py,sha256=EwD4-1THC5YNdP6PY01Oe35k2QYYqtZpxWraPVH6wa4,16426
|
17
17
|
risk/network/io.py,sha256=kY7HqmL3wa1NnqHu61_G8IpT21qpBijpAZ4ixmsseJA,22911
|
18
|
-
risk/network/plot.py,sha256=
|
18
|
+
risk/network/plot.py,sha256=1WmEfmaKrJuMMMQYbVtcuqPwRw3WxFqC2pjHIDX6fpE,85479
|
19
19
|
risk/stats/__init__.py,sha256=WcgoETQ-hS0LQqKRsAMIPtP15xZ-4eul6VUBuUx4Wzc,220
|
20
20
|
risk/stats/hypergeom.py,sha256=o6Qnj31gCAKxr2uQirXrbv7XvdDJGEq69MFW-ubx_hA,2272
|
21
21
|
risk/stats/poisson.py,sha256=8x9hB4DCukq4gNIlIKO-c_jYG1-BTwTX53oLauFyfj8,1793
|
@@ -23,8 +23,8 @@ risk/stats/stats.py,sha256=kvShov-94W6ffgDUTb522vB9hDJQSyTsYif_UIaFfSM,7059
|
|
23
23
|
risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
|
24
24
|
risk/stats/permutation/permutation.py,sha256=D84Rcpt6iTQniK0PfQGcw9bLcHbMt9p-ARcurUnIXZQ,10095
|
25
25
|
risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
|
26
|
-
risk_network-0.0.
|
27
|
-
risk_network-0.0.
|
28
|
-
risk_network-0.0.
|
29
|
-
risk_network-0.0.
|
30
|
-
risk_network-0.0.
|
26
|
+
risk_network-0.0.8b6.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
27
|
+
risk_network-0.0.8b6.dist-info/METADATA,sha256=CctmgVn--95TlPIJhjI30rqZDobg1eI6F4DRTm1CFNc,47450
|
28
|
+
risk_network-0.0.8b6.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
29
|
+
risk_network-0.0.8b6.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
30
|
+
risk_network-0.0.8b6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|