iplotx 1.5.0__py3-none-any.whl → 1.6.0__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.
iplotx/edge/__init__.py CHANGED
@@ -367,21 +367,13 @@ class EdgeCollection(mpl.collections.PatchCollection):
367
367
 
368
368
  # Leaf rotation
369
369
  edge_stylei = rotate_style(self._style, index=i, key=(v1, v2))
370
- if edge_stylei.get("curved", False):
371
- tension = edge_stylei.get("tension", 5)
372
- ports = edge_stylei.get("ports", (None, None))
373
- elif edge_stylei.get("arc", False):
374
- tension = edge_stylei.get("tension", 1)
375
- ports = None
376
- else:
377
- tension = 0
378
- ports = None
379
370
 
380
371
  # Scale shrink by dpi
381
372
  dpi = self.figure.dpi if hasattr(self, "figure") else 72.0
382
373
  shrink = dpi / 72.0 * edge_stylei.pop("shrink", 0)
383
374
 
384
- # False is a synonym for "none"
375
+ # Edge geometry and waypoints
376
+ # waypoints: False is a synonym for "none"
385
377
  waypoints = edge_stylei.get("waypoints", "none")
386
378
  if waypoints is False or waypoints is np.False_:
387
379
  waypoints = "none"
@@ -391,10 +383,32 @@ class EdgeCollection(mpl.collections.PatchCollection):
391
383
  raise ValueError(
392
384
  "Could not determine automatically type of edge waypoints.",
393
385
  )
394
- if waypoints != "none":
395
- ports = edge_stylei.get("ports", (None, None))
396
386
 
387
+ # Waypoints, curved, and arc have a complex logic
388
+ # TODO: This could be simplified I suppose
389
+ has_waypoints = waypoints != "none"
390
+ curved = edge_stylei.get("curved", False)
397
391
  arc = edge_stylei.get("arc", False)
392
+ ports = edge_stylei.get("ports", (None, None))
393
+
394
+ # For now, we establish a hierarchy from the most specialised to
395
+ # the most common cases. Each specialisation silences lower levels
396
+ # Tension and ports are entirely enslaved to the
397
+ # waypoint/arc/curved geometry settings.
398
+ # NOTE: The idea here is to not punish users for slight style
399
+ # inconsistencies that may well stem from fallback libraries
400
+ if has_waypoints:
401
+ tension = 0
402
+ arc = False
403
+ elif arc:
404
+ tension = edge_stylei.get("tension", 1)
405
+ ports = None
406
+ curved = False
407
+ elif curved:
408
+ tension = edge_stylei.get("tension", 5)
409
+ else:
410
+ tension = 0
411
+ ports = None
398
412
 
399
413
  # Compute actual edge path
400
414
  path, angles = _compute_edge_path(
@@ -406,6 +420,7 @@ class EdgeCollection(mpl.collections.PatchCollection):
406
420
  tension=tension,
407
421
  waypoints=waypoints,
408
422
  ports=ports,
423
+ curved=curved,
409
424
  arc=arc,
410
425
  layout_coordinate_system=self._vertex_collection.get_layout_coordinate_system(),
411
426
  shrink=shrink,
iplotx/edge/geometry.py CHANGED
@@ -239,6 +239,7 @@ def _compute_edge_path_straight(
239
239
 
240
240
  def _compute_edge_path_waypoints(
241
241
  waypoints,
242
+ curved,
242
243
  vcoord_data,
243
244
  vpath_fig,
244
245
  vsize_fig,
@@ -277,8 +278,19 @@ def _compute_edge_path_waypoints(
277
278
  + vcoord_fig[i]
278
279
  )
279
280
 
280
- points = [vshorts[0]] + list(waypoints) + [vshorts[1]]
281
- codes = ["MOVETO"] + ["LINETO"] * len(waypoints) + ["LINETO"]
281
+ if not curved:
282
+ points = [vshorts[0]] + list(waypoints) + [vshorts[1]]
283
+ codes = ["MOVETO"] + ["LINETO"] * len(waypoints) + ["LINETO"]
284
+ else:
285
+ points = [vshorts[0]]
286
+ for i, waypoint in enumerate(waypoints):
287
+ if i != 0:
288
+ points.append(0.5 * (points[-1] + waypoint))
289
+ points.append(waypoint)
290
+ points.append(waypoint)
291
+ points.append(vshorts[1])
292
+ codes = ["MOVETO"] + ["CURVE4"] * (len(points) - 1)
293
+
282
294
  angles = tuple(thetas)
283
295
 
284
296
  elif waypoints in ("x0y1", "y0x1"):
@@ -587,6 +599,7 @@ def _compute_edge_path(
587
599
  tension: float = 0,
588
600
  waypoints: str | tuple[float, float] | Sequence[tuple[float, float]] | np.ndarray = "none",
589
601
  ports: Pair[Optional[str]] = (None, None),
602
+ curved: bool = False,
590
603
  arc: bool = False,
591
604
  layout_coordinate_system: str = "cartesian",
592
605
  **kwargs,
@@ -600,6 +613,7 @@ def _compute_edge_path(
600
613
  if waypoints != "none":
601
614
  return _compute_edge_path_waypoints(
602
615
  waypoints,
616
+ curved,
603
617
  *args,
604
618
  layout_coordinate_system=layout_coordinate_system,
605
619
  ports=ports,
iplotx/version.py CHANGED
@@ -2,4 +2,4 @@
2
2
  iplotx version information module.
3
3
  """
4
4
 
5
- __version__ = "1.5.0"
5
+ __version__ = "1.6.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iplotx
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: Plot networkx from igraph and networkx.
5
5
  Project-URL: Homepage, https://github.com/fabilab/iplotx
6
6
  Project-URL: Documentation, https://readthedocs.org/iplotx
@@ -3,15 +3,15 @@ iplotx/artists.py,sha256=2dBDT240zGwKb6tIc_y9pXeyU3LuYeF9wjj2tvi4KJo,730
3
3
  iplotx/label.py,sha256=7eS8ByadrhdIFOZz19U4VrS-oXY_ndFYNB-D4RZbFqI,9573
4
4
  iplotx/plotting.py,sha256=RyAdvaHSpuyJkf8DF3SJBvEXBrPmJEdovUyAlBWQvqU,16228
5
5
  iplotx/typing.py,sha256=QLdzV358IiD1CFe88MVp0D77FSx5sSAVUmM_2WPPE8I,1463
6
- iplotx/version.py,sha256=dHoG6x6aINBmE0KlFSrXNW1gCmtIOfGa2oJaCjtGZlE,66
6
+ iplotx/version.py,sha256=FuQ50YfUAzVu7Ebc11JUJcD5XAW6-g-5gcQOldsIb-U,66
7
7
  iplotx/vertex.py,sha256=Ta48M_6ZT8xKQWdI5XHiRxTt2LlJ9vshiDk34OzKYlY,16585
8
8
  iplotx/art3d/vertex.py,sha256=Xf8Um30X2doCd8KdNN7332F6BxC4k72Mb_GeRAuzQfQ,2545
9
9
  iplotx/art3d/edge/__init__.py,sha256=uw1U_mMXqcZAvea-7JbU1PUKULQD1CMMrbwY02tiWRQ,8529
10
10
  iplotx/art3d/edge/arrow.py,sha256=14BFXY9kDOUGPZl2fMD9gRVGyaaN5kyd-l6ikBg6WHU,3601
11
11
  iplotx/art3d/edge/geometry.py,sha256=76VUmpPG-4Mls7x_994dMwdDPrWWnjT7nHJsHfwK_hA,2467
12
- iplotx/edge/__init__.py,sha256=8iHtkrEaxseh308VWlTgbZ7OJECqkRwSq-oJzejxH5U,26837
12
+ iplotx/edge/__init__.py,sha256=mp_JRGeJWPXZNpQ6vTgTdzgVO1YxcZMKuVKarJGuLnY,27522
13
13
  iplotx/edge/arrow.py,sha256=ymup2YT_0GVYMtZw_DSKrZqFHG_ysYteEhmoL6T8Mu4,17563
14
- iplotx/edge/geometry.py,sha256=Vt1Y_wH2Fto_rgrQbuhXUzsfBpjQLti8Qws-oAGLcUw,19745
14
+ iplotx/edge/geometry.py,sha256=Qyi7Q7sOGAFXU6gFeWFLm6OoGetEasrfv8HzgSWO2gY,20210
15
15
  iplotx/edge/leaf.py,sha256=SyGMv2PIOoH0pey8-aMVaZheK3hNe1Qz_okcyWbc4E4,4268
16
16
  iplotx/edge/ports.py,sha256=BpkbiEhX4mPBBAhOv4jcKFG4Y8hxXz5GRtVLCC0jbtI,1235
17
17
  iplotx/ingest/__init__.py,sha256=k1Q-7lSdotMR4RkF1x0t19RFsTknohX0L507Dw69WyU,5035
@@ -43,6 +43,6 @@ iplotx/utils/geometry.py,sha256=6RrC6qaB0-1vIk1LhGA4CfsiMd-9JNniSPyL_l9mshE,9245
43
43
  iplotx/utils/internal.py,sha256=WWfcZDGK8Ut1y_tOHRGg9wSqY1bwSeLQO7dHM_8Tvwo,107
44
44
  iplotx/utils/matplotlib.py,sha256=p_53Oamof0RI4mtV8HrdDtZbgVqUxeUZ_KDvLZSiBUQ,8604
45
45
  iplotx/utils/style.py,sha256=vyNP80nDYVinqm6_9ltCJCtjK35ZcGlHvOskNv3eQBc,4225
46
- iplotx-1.5.0.dist-info/METADATA,sha256=smIckmasPHKrTHRupED_eiRfm7O0UkesY-r-4CpJGvM,5407
47
- iplotx-1.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
- iplotx-1.5.0.dist-info/RECORD,,
46
+ iplotx-1.6.0.dist-info/METADATA,sha256=dyJUY-7XhULve7DdsDLjEjqIO8o7EtXauCkqEpSt0B4,5407
47
+ iplotx-1.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
+ iplotx-1.6.0.dist-info/RECORD,,
File without changes