iplotx 1.4.1__py3-none-any.whl → 1.5.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/geometry.py CHANGED
@@ -466,15 +466,17 @@ def _compute_edge_path_arc(
466
466
  )
467
467
  angle_start = atan2(*(vs[0] - center)[::-1])
468
468
  angle_end = atan2(*(vs[1] - center)[::-1])
469
- if (np.abs(tension) > 1) and (np.abs(angle_end - angle_start) < np.pi):
470
- if angle_end > angle_start:
471
- angle_start += 2 * np.pi
472
- else:
473
- angle_end += 2 * np.pi
469
+
470
+ # Figure out how to draw the correct arc of the two
471
+ if (tension > 0) and (angle_end < angle_start):
472
+ angle_end += 2 * np.pi
473
+ elif (tension < 0) and (angle_end > angle_start):
474
+ angle_start += 2 * np.pi
475
+
474
476
  # print(f"angle_start: {np.degrees(angle_start):.2f}")
475
477
  # print(f"angle_end: {np.degrees(angle_end):.2f}")
476
478
 
477
- naux = 30
479
+ naux = max(30, int(np.ceil(np.degrees(np.abs(angle_end - angle_start)))) // 3)
478
480
  angles = np.linspace(angle_start, angle_end, naux + 2)[1:-1]
479
481
  auxs = center + np.array([np.cos(angles), np.sin(angles)]).T * np.linalg.norm(
480
482
  vs[0] - center
iplotx/version.py CHANGED
@@ -2,4 +2,4 @@
2
2
  iplotx version information module.
3
3
  """
4
4
 
5
- __version__ = "1.4.1"
5
+ __version__ = "1.5.0"
iplotx/vertex.py CHANGED
@@ -14,6 +14,7 @@ import matplotlib as mpl
14
14
  from matplotlib.collections import PatchCollection
15
15
  from matplotlib.patches import (
16
16
  Patch,
17
+ PathPatch,
17
18
  Polygon,
18
19
  Ellipse,
19
20
  Circle,
@@ -393,7 +394,7 @@ class VertexCollection(PatchCollection):
393
394
 
394
395
 
395
396
  def make_patch(
396
- marker: str = "o",
397
+ marker: str | Polygon | mpl.path.Path = "o",
397
398
  size: float | Sequence[float] = 20,
398
399
  **kwargs,
399
400
  ) -> tuple[Patch, float]:
@@ -475,6 +476,23 @@ def make_patch(
475
476
  ][::-1],
476
477
  **kwargs,
477
478
  )
479
+ elif isinstance(marker, Polygon):
480
+ xy = marker.get_xy()
481
+ xy_sizes = xy.max(axis=0) - xy.min(axis=0)
482
+ art = Polygon(
483
+ xy * size / xy_sizes,
484
+ **kwargs,
485
+ )
486
+ elif isinstance(marker, mpl.path.Path):
487
+ xy = marker.vertices
488
+ xy_sizes = xy.max(axis=0) - xy.min(axis=0)
489
+ art = PathPatch(
490
+ mpl.path.Path(
491
+ xy * size / xy_sizes,
492
+ codes=marker.codes,
493
+ ),
494
+ **kwargs,
495
+ )
478
496
  else:
479
497
  raise KeyError(f"Unknown marker: {marker}")
480
498
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iplotx
3
- Version: 1.4.1
3
+ Version: 1.5.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=pDHOlKcY4NkjVyT63s4sF7EXMk_RlMLYxzkdejRQNr8,66
7
- iplotx/vertex.py,sha256=_yYyvusn4vYvi6RBEW6CHa3vnbv43GnZylnMIaK4bG0,16040
6
+ iplotx/version.py,sha256=dHoG6x6aINBmE0KlFSrXNW1gCmtIOfGa2oJaCjtGZlE,66
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
12
  iplotx/edge/__init__.py,sha256=8iHtkrEaxseh308VWlTgbZ7OJECqkRwSq-oJzejxH5U,26837
13
13
  iplotx/edge/arrow.py,sha256=ymup2YT_0GVYMtZw_DSKrZqFHG_ysYteEhmoL6T8Mu4,17563
14
- iplotx/edge/geometry.py,sha256=dczXCLCn5vlFm_SwXXh_gwf0h7irILSCdNIDKTuuqmA,19646
14
+ iplotx/edge/geometry.py,sha256=Vt1Y_wH2Fto_rgrQbuhXUzsfBpjQLti8Qws-oAGLcUw,19745
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.4.1.dist-info/METADATA,sha256=8ZAla76ojuZ1bfzsj3gTS-agA44OIz0Ze18Hc-p3Gcg,5407
47
- iplotx-1.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
- iplotx-1.4.1.dist-info/RECORD,,
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,,
File without changes