risk-network 0.0.8b5__py3-none-any.whl → 0.0.8b7__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 CHANGED
@@ -7,4 +7,4 @@ RISK: RISK Infers Spatial Kinships
7
7
 
8
8
  from risk.risk import RISK
9
9
 
10
- __version__ = "0.0.8-beta.5"
10
+ __version__ = "0.0.8-beta.7"
@@ -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. Defaults to 1.0.
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 = 1.0,
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. Defaults to 1.0.
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. Defaults to 1.0.
195
- fill_alpha (float, optional): Transparency level of the circle fill. Defaults to 0.0.
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(
@@ -209,6 +213,8 @@ class NetworkPlotter:
209
213
 
210
214
  # Convert color to RGBA using the _to_rgba helper function - use outline_alpha for the perimeter
211
215
  color = _to_rgba(color=color, alpha=outline_alpha)
216
+ # Set the fill_alpha to 0 if not provided
217
+ fill_alpha = fill_alpha if fill_alpha is not None else 0.0
212
218
  # Extract node coordinates from the network graph
213
219
  node_coordinates = self.graph.node_coordinates
214
220
  # Calculate the center and radius of the bounding box around the network
@@ -240,8 +246,8 @@ class NetworkPlotter:
240
246
  color: Union[str, List, Tuple, np.ndarray] = "black",
241
247
  linestyle: str = "solid",
242
248
  linewidth: float = 1.5,
243
- outline_alpha: float = 1.0,
244
- fill_alpha: float = 0.0,
249
+ outline_alpha: Union[float, None] = 1.0,
250
+ fill_alpha: Union[float, None] = 0.0,
245
251
  ) -> None:
246
252
  """
247
253
  Plot a KDE-based contour around the network graph to represent the network perimeter.
@@ -254,8 +260,10 @@ class NetworkPlotter:
254
260
  color (str, list, tuple, or np.ndarray, optional): Color of the network perimeter contour. Defaults to "black".
255
261
  linestyle (str, optional): Line style for the network perimeter contour (e.g., dashed, solid). Defaults to "solid".
256
262
  linewidth (float, optional): Width of the contour's outline. Defaults to 1.5.
257
- outline_alpha (float, optional): Transparency level of the contour outline. Defaults to 1.0.
258
- fill_alpha (float, optional): Transparency level of the contour fill. Defaults to 0.0.
263
+ outline_alpha (float, None, optional): Transparency level of the contour outline. If provided, it overrides any existing
264
+ alpha values found in color. Defaults to 1.0.
265
+ fill_alpha (float, None, optional): Transparency level of the contour fill. If provided, it overrides any existing alpha
266
+ values found in color. Defaults to 0.0.
259
267
  """
260
268
  # Log the contour perimeter plotting parameters
261
269
  params.log_plotter(
@@ -300,8 +308,8 @@ class NetworkPlotter:
300
308
  node_color: Union[str, List, Tuple, np.ndarray] = "white",
301
309
  node_edgecolor: Union[str, List, Tuple, np.ndarray] = "black",
302
310
  edge_color: Union[str, List, Tuple, np.ndarray] = "black",
303
- node_alpha: float = 1.0,
304
- edge_alpha: float = 1.0,
311
+ node_alpha: Union[float, None] = 1.0,
312
+ edge_alpha: Union[float, None] = 1.0,
305
313
  ) -> None:
306
314
  """Plot the network graph with customizable node colors, sizes, edge widths, and node edge widths.
307
315
 
@@ -310,11 +318,14 @@ class NetworkPlotter:
310
318
  node_shape (str, optional): Shape of the nodes. Defaults to "o".
311
319
  node_edgewidth (float, optional): Width of the node edges. Defaults to 1.0.
312
320
  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. Defaults to "white".
321
+ node_color (str, list, tuple, or np.ndarray, optional): Color of the nodes. Can be a single color or an array of colors.
322
+ Defaults to "white".
314
323
  node_edgecolor (str, list, tuple, or np.ndarray, optional): Color of the node edges. Defaults to "black".
315
324
  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. Defaults to 1.0. Annotated node_color alphas will override this value.
317
- edge_alpha (float, optional): Alpha value (transparency) for the edges. Defaults to 1.0.
325
+ node_alpha (float, None, optional): Alpha value (transparency) for the nodes. If provided, it overrides any existing alpha
326
+ values found in node_color. Defaults to 1.0. Annotated node_color alphas will override this value.
327
+ edge_alpha (float, None, optional): Alpha value (transparency) for the edges. If provided, it overrides any existing alpha
328
+ values found in edge_color. Defaults to 1.0.
318
329
  """
319
330
  # Log the plotting parameters
320
331
  params.log_plotter(
@@ -378,8 +389,8 @@ class NetworkPlotter:
378
389
  node_color: Union[str, List, Tuple, np.ndarray] = "white",
379
390
  node_edgecolor: Union[str, List, Tuple, np.ndarray] = "black",
380
391
  edge_color: Union[str, List, Tuple, np.ndarray] = "black",
381
- node_alpha: float = 1.0,
382
- edge_alpha: float = 1.0,
392
+ node_alpha: Union[float, None] = None,
393
+ edge_alpha: Union[float, None] = None,
383
394
  ) -> None:
384
395
  """Plot a subnetwork of selected nodes with customizable node and edge attributes.
385
396
 
@@ -392,8 +403,10 @@ class NetworkPlotter:
392
403
  node_color (str, list, tuple, or np.ndarray, optional): Color of the nodes. Defaults to "white".
393
404
  node_edgecolor (str, list, tuple, or np.ndarray, optional): Color of the node edges. Defaults to "black".
394
405
  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. Defaults to 1.0.
396
- edge_alpha (float, optional): Transparency for the edges. Defaults to 1.0.
406
+ node_alpha (float, None, optional): Transparency for the nodes. If provided, it overrides any existing alpha values
407
+ found in node_color. Defaults to 1.0.
408
+ edge_alpha (float, None, optional): Transparency for the edges. If provided, it overrides any existing alpha values
409
+ found in node_color. Defaults to 1.0.
397
410
 
398
411
  Raises:
399
412
  ValueError: If no valid nodes are found in the network graph.
@@ -459,8 +472,8 @@ class NetworkPlotter:
459
472
  color: Union[str, List, Tuple, np.ndarray] = "white",
460
473
  linestyle: str = "solid",
461
474
  linewidth: float = 1.5,
462
- alpha: float = 1.0,
463
- fill_alpha: float = 0.2,
475
+ alpha: Union[float, None] = 1.0,
476
+ fill_alpha: Union[float, None] = None,
464
477
  ) -> None:
465
478
  """Draw KDE contours for nodes in various domains of a network graph, highlighting areas of high density.
466
479
 
@@ -468,11 +481,14 @@ class NetworkPlotter:
468
481
  levels (int, optional): Number of contour levels to plot. Defaults to 5.
469
482
  bandwidth (float, optional): Bandwidth for KDE. Controls the smoothness of the contour. Defaults to 0.8.
470
483
  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. Defaults to "white".
484
+ color (str, list, tuple, or np.ndarray, optional): Color of the contours. Can be a single color or an array of colors.
485
+ Defaults to "white".
472
486
  linestyle (str, optional): Line style for the contours. Defaults to "solid".
473
487
  linewidth (float, optional): Line width for the contours. Defaults to 1.5.
474
- alpha (float, optional): Transparency level of the contour lines. Defaults to 1.0.
475
- fill_alpha (float, optional): Transparency level of the contour fill. Defaults to 0.2.
488
+ alpha (float, None, optional): Transparency level of the contour lines. If provided, it overrides any existing alpha values
489
+ found in color. Defaults to 1.0.
490
+ fill_alpha (float, None, optional): Transparency level of the contour fill. If provided, it overrides any existing alpha
491
+ values found in color. Defaults to None.
476
492
  """
477
493
  # Log the contour plotting parameters
478
494
  params.log_plotter(
@@ -518,8 +534,8 @@ class NetworkPlotter:
518
534
  color: Union[str, List, Tuple, np.ndarray] = "white",
519
535
  linestyle: str = "solid",
520
536
  linewidth: float = 1.5,
521
- alpha: float = 1.0,
522
- fill_alpha: float = 0.2,
537
+ alpha: Union[float, None] = 1.0,
538
+ fill_alpha: Union[float, None] = None,
523
539
  ) -> None:
524
540
  """Plot a subcontour for a given set of nodes or a list of node sets using Kernel Density Estimation (KDE).
525
541
 
@@ -528,11 +544,14 @@ class NetworkPlotter:
528
544
  levels (int, optional): Number of contour levels to plot. Defaults to 5.
529
545
  bandwidth (float, optional): Bandwidth for KDE. Controls the smoothness of the contour. Defaults to 0.8.
530
546
  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. Defaults to "white".
547
+ color (str, list, tuple, or np.ndarray, optional): Color of the contour. Can be a string (e.g., 'white') or RGBA array.
548
+ Defaults to "white".
532
549
  linestyle (str, optional): Line style for the contour. Defaults to "solid".
533
550
  linewidth (float, optional): Line width for the contour. Defaults to 1.5.
534
- alpha (float, optional): Transparency level of the contour lines. Defaults to 1.0.
535
- fill_alpha (float, optional): Transparency level of the contour fill. Defaults to 0.2.
551
+ alpha (float, None, optional): Transparency level of the contour lines. If provided, it overrides any existing alpha values
552
+ found in color. Defaults to 1.0.
553
+ fill_alpha (float, None, optional): Transparency level of the contour fill. If provided, it overrides any existing alpha
554
+ values found in color. Defaults to None.
536
555
 
537
556
  Raises:
538
557
  ValueError: If no valid nodes are found in the network graph.
@@ -588,8 +607,8 @@ class NetworkPlotter:
588
607
  color: Union[str, np.ndarray] = "white",
589
608
  linestyle: str = "solid",
590
609
  linewidth: float = 1.5,
591
- alpha: float = 1.0,
592
- fill_alpha: float = 0.2,
610
+ alpha: Union[float, None] = 1.0,
611
+ fill_alpha: Union[float, None] = 0.2,
593
612
  ) -> None:
594
613
  """Draw a Kernel Density Estimate (KDE) contour plot for a set of nodes on a given axis.
595
614
 
@@ -603,8 +622,10 @@ class NetworkPlotter:
603
622
  color (str or np.ndarray): Color for the contour. Can be a string or RGBA array. Defaults to "white".
604
623
  linestyle (str, optional): Line style for the contour. Defaults to "solid".
605
624
  linewidth (float, optional): Line width for the contour. Defaults to 1.5.
606
- alpha (float, optional): Transparency level for the contour lines. Defaults to 1.0.
607
- fill_alpha (float, optional): Transparency level for the contour fill. Defaults to 0.2.
625
+ alpha (float, None, optional): Transparency level for the contour lines. If provided, it overrides any existing alpha
626
+ values found in color. Defaults to 1.0.
627
+ fill_alpha (float, None, optional): Transparency level for the contour fill. If provided, it overrides any existing
628
+ alpha values found in color. Defaults to 0.2.
608
629
  """
609
630
  # Extract the positions of the specified nodes
610
631
  points = np.array([pos[n] for n in nodes])
@@ -657,7 +678,7 @@ class NetworkPlotter:
657
678
  # Set the contour color and linestyle
658
679
  contour_colors = [color for _ in range(levels - 1)]
659
680
  # Plot the filled contours using fill_alpha for transparency
660
- if fill_alpha > 0:
681
+ if fill_alpha and fill_alpha > 0:
661
682
  ax.contourf(
662
683
  x,
663
684
  y,
@@ -691,11 +712,11 @@ class NetworkPlotter:
691
712
  font: str = "Arial",
692
713
  fontsize: int = 10,
693
714
  fontcolor: Union[str, List, Tuple, np.ndarray] = "black",
694
- fontalpha: float = 1.0,
715
+ fontalpha: Union[float, None] = 1.0,
695
716
  arrow_linewidth: float = 1,
696
717
  arrow_style: str = "->",
697
718
  arrow_color: Union[str, List, Tuple, np.ndarray] = "black",
698
- arrow_alpha: float = 1.0,
719
+ arrow_alpha: Union[float, None] = 1.0,
699
720
  arrow_base_shrink: float = 0.0,
700
721
  arrow_tip_shrink: float = 0.0,
701
722
  max_labels: Union[int, None] = None,
@@ -715,12 +736,15 @@ class NetworkPlotter:
715
736
  offset (float, optional): Offset distance for labels from the perimeter. Defaults to 0.10.
716
737
  font (str, optional): Font name for the labels. Defaults to "Arial".
717
738
  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. Defaults to "black".
719
- fontalpha (float, optional): Transparency level for the font color. Defaults to 1.0.
739
+ fontcolor (str, list, tuple, or np.ndarray, optional): Color of the label text. Can be a string or RGBA array.
740
+ Defaults to "black".
741
+ fontalpha (float, None, optional): Transparency level for the font color. If provided, it overrides any existing alpha
742
+ values found in fontcolor. Defaults to 1.0.
720
743
  arrow_linewidth (float, optional): Line width of the arrows pointing to centroids. Defaults to 1.
721
744
  arrow_style (str, optional): Style of the arrows pointing to centroids. Defaults to "->".
722
745
  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. Defaults to 1.0.
746
+ arrow_alpha (float, None, optional): Transparency level for the arrow color. If provided, it overrides any existing alpha
747
+ values found in arrow_color. Defaults to 1.0.
724
748
  arrow_base_shrink (float, optional): Distance between the text and the base of the arrow. Defaults to 0.0.
725
749
  arrow_tip_shrink (float, optional): Distance between the arrow tip and the centroid. Defaults to 0.0.
726
750
  max_labels (int, optional): Maximum number of labels to plot. Defaults to None (no limit).
@@ -732,9 +756,9 @@ class NetworkPlotter:
732
756
  overlay_ids (bool, optional): Whether to overlay domain IDs in the center of the centroids. Defaults to False.
733
757
  ids_to_keep (list, tuple, np.ndarray, or None, optional): IDs of domains that must be labeled. To discover domain IDs,
734
758
  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 space-separated words.
736
- If provided, the custom labels will replace the default domain terms. To discover domain IDs, you can set `overlay_ids=True`.
737
- Defaults to None.
759
+ ids_to_replace (dict, optional): A dictionary mapping domain IDs to custom labels (strings). The labels should be
760
+ space-separated words. If provided, the custom labels will replace the default domain terms. To discover domain IDs, you
761
+ can set `overlay_ids=True`. Defaults to None.
738
762
 
739
763
  Raises:
740
764
  ValueError: If the number of provided `ids_to_keep` exceeds `max_labels`.
@@ -895,11 +919,11 @@ class NetworkPlotter:
895
919
  font: str = "Arial",
896
920
  fontsize: int = 10,
897
921
  fontcolor: Union[str, List, Tuple, np.ndarray] = "black",
898
- fontalpha: float = 1.0,
922
+ fontalpha: Union[float, None] = 1.0,
899
923
  arrow_linewidth: float = 1,
900
924
  arrow_style: str = "->",
901
925
  arrow_color: Union[str, List, Tuple, np.ndarray] = "black",
902
- arrow_alpha: float = 1.0,
926
+ arrow_alpha: Union[float, None] = 1.0,
903
927
  arrow_base_shrink: float = 0.0,
904
928
  arrow_tip_shrink: float = 0.0,
905
929
  ) -> None:
@@ -914,11 +938,13 @@ class NetworkPlotter:
914
938
  font (str, optional): Font name for the label. Defaults to "Arial".
915
939
  fontsize (int, optional): Font size for the label. Defaults to 10.
916
940
  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. Defaults to 1.0.
941
+ fontalpha (float, None, optional): Transparency level for the font color. If provided, it overrides any existing alpha values found
942
+ in fontalpha. Defaults to 1.0.
918
943
  arrow_linewidth (float, optional): Line width of the arrow pointing to the centroid. Defaults to 1.
919
944
  arrow_style (str, optional): Style of the arrows pointing to the centroid. Defaults to "->".
920
945
  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. Defaults to 1.0.
946
+ arrow_alpha (float, None, optional): Transparency level for the arrow color. If provided, it overrides any existing alpha values
947
+ found in arrow_alpha. Defaults to 1.0.
922
948
  arrow_base_shrink (float, optional): Distance between the text and the base of the arrow. Defaults to 0.0.
923
949
  arrow_tip_shrink (float, optional): Distance between the arrow tip and the centroid. Defaults to 0.0.
924
950
  """
@@ -1275,9 +1301,9 @@ class NetworkPlotter:
1275
1301
  min_scale: float = 0.8,
1276
1302
  max_scale: float = 1.0,
1277
1303
  scale_factor: float = 1.0,
1278
- alpha: float = 1.0,
1304
+ alpha: Union[float, None] = 1.0,
1279
1305
  nonenriched_color: Union[str, List, Tuple, np.ndarray] = "white",
1280
- nonenriched_alpha: float = 1.0,
1306
+ nonenriched_alpha: Union[float, None] = 1.0,
1281
1307
  random_seed: int = 888,
1282
1308
  ) -> np.ndarray:
1283
1309
  """Adjust the colors of nodes in the network graph based on enrichment.
@@ -1288,9 +1314,11 @@ class NetworkPlotter:
1288
1314
  min_scale (float, optional): Minimum scale for color intensity. Defaults to 0.8.
1289
1315
  max_scale (float, optional): Maximum scale for color intensity. Defaults to 1.0.
1290
1316
  scale_factor (float, optional): Factor for adjusting the color scaling intensity. Defaults to 1.0.
1291
- alpha (float, optional): Alpha value for enriched nodes. Defaults to 1.0.
1317
+ alpha (float, None, optional): Alpha value for enriched nodes. If provided, it overrides any existing alpha values
1318
+ found in color. Defaults to 1.0.
1292
1319
  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. Defaults to 1.0.
1320
+ nonenriched_alpha (float, None, optional): Alpha value for non-enriched nodes. If provided, it overrides any existing
1321
+ alpha values found in nonenriched_color. Defaults to 1.0.
1294
1322
  random_seed (int, optional): Seed for random number generation. Defaults to 888.
1295
1323
 
1296
1324
  Returns:
@@ -1493,7 +1521,8 @@ def _to_rgba(
1493
1521
 
1494
1522
  Args:
1495
1523
  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.
1524
+ alpha (float, None, optional): Alpha value (transparency) to apply. If provided, it overrides any existing alpha values
1525
+ found in color.
1497
1526
  num_repeats (int, None, optional): If provided, the color(s) will be repeated this many times. Defaults to None.
1498
1527
 
1499
1528
  Returns:
@@ -1502,6 +1531,7 @@ def _to_rgba(
1502
1531
 
1503
1532
  def convert_to_rgba(c: Union[str, List, Tuple, np.ndarray]) -> np.ndarray:
1504
1533
  """Convert a single color to RGBA format, handling strings, hex, and RGB/RGBA lists."""
1534
+ # Note: if no alpha is provided, the default alpha value is 1.0 by mcolors.to_rgba
1505
1535
  if isinstance(c, str):
1506
1536
  # Convert color names or hex values (e.g., 'red', '#FF5733') to RGBA
1507
1537
  rgba = np.array(mcolors.to_rgba(c))
risk/risk.py CHANGED
@@ -3,7 +3,7 @@ risk/risk
3
3
  ~~~~~~~~~
4
4
  """
5
5
 
6
- from typing import Any, Dict, Tuple
6
+ from typing import Any, Dict, Tuple, Union
7
7
 
8
8
  import networkx as nx
9
9
  import numpy as np
@@ -355,6 +355,7 @@ class RISK(NetworkIO, AnnotationsIO):
355
355
  graph: NetworkGraph,
356
356
  figsize: Tuple = (10, 10),
357
357
  background_color: str = "white",
358
+ background_alpha: Union[float, None] = 1.0,
358
359
  ) -> NetworkPlotter:
359
360
  """Get a NetworkPlotter object for plotting.
360
361
 
@@ -362,6 +363,8 @@ class RISK(NetworkIO, AnnotationsIO):
362
363
  graph (NetworkGraph): The graph to plot.
363
364
  figsize (tuple, optional): Size of the figure. Defaults to (10, 10).
364
365
  background_color (str, optional): Background color of the plot. Defaults to "white".
366
+ background_alpha (float, None, optional): Transparency level of the background color. If provided, it overrides
367
+ any existing alpha values found in background_color. Defaults to 1.0.
365
368
 
366
369
  Returns:
367
370
  NetworkPlotter: A NetworkPlotter object configured with the given parameters.
@@ -378,6 +381,7 @@ class RISK(NetworkIO, AnnotationsIO):
378
381
  graph,
379
382
  figsize=figsize,
380
383
  background_color=background_color,
384
+ background_alpha=background_alpha,
381
385
  )
382
386
 
383
387
  def _load_neighborhoods(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: risk-network
3
- Version: 0.0.8b5
3
+ Version: 0.0.8b7
4
4
  Summary: A Python package for biological network analysis
5
5
  Author: Ira Horecka
6
6
  Author-email: Ira Horecka <ira89@icloud.com>
@@ -1,6 +1,6 @@
1
- risk/__init__.py,sha256=2GschYTLwmGIvkQltbf0EfXkWUv5e0Y760GJNGFzDWQ,112
1
+ risk/__init__.py,sha256=Ld6-5HUuOVDCaSGqPvt7caqDuDx8YQ6yDSV1MrTjnCQ,112
2
2
  risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
3
- risk/risk.py,sha256=FaQhDCBZxZSAXJsScH0rSbjjCTNZA5vgf9rJj1GHW44,20924
3
+ risk/risk.py,sha256=uZH7GuADCAAkDIx-rPlS6O_is6tUU2Hg28P8xpR-d9g,21240
4
4
  risk/annotations/__init__.py,sha256=vUpVvMRE5if01Ic8QY6M2Ae3EFGJHdugEe9PdEkAW4Y,138
5
5
  risk/annotations/annotations.py,sha256=ySc_N3nXnKx5RnOpFaEkM6zvTbswbrRcfFLzM0KdOck,11391
6
6
  risk/annotations/io.py,sha256=TTXVJQgUGAlKpnGBcx7Dow146IGyozA03nSbl3S7M5M,9475
@@ -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=dLugXFhQ5QZ2JjuLLAbEuB6FxcWqDnItT-6Cilotw5I,82982
18
+ risk/network/plot/base.py,sha256=8Wbrm2Es8cGYGGGOoJqzeUfuDlNlgJ4_6IEIIfMShN8,85611
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.8b5.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
27
- risk_network-0.0.8b5.dist-info/METADATA,sha256=Lf97YQxcZGwjylO_c21AJQz8ZmdwKWkI5EbPtnl49u8,47450
28
- risk_network-0.0.8b5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
29
- risk_network-0.0.8b5.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
30
- risk_network-0.0.8b5.dist-info/RECORD,,
26
+ risk_network-0.0.8b7.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
27
+ risk_network-0.0.8b7.dist-info/METADATA,sha256=wOm-_aHavf5zpMp_UjqIBx2NPl4nR_2YtS1cfFn6UBA,47450
28
+ risk_network-0.0.8b7.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
29
+ risk_network-0.0.8b7.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
30
+ risk_network-0.0.8b7.dist-info/RECORD,,