iplotx 1.0.1__py3-none-any.whl → 1.1.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/layout.py CHANGED
@@ -2,7 +2,10 @@
2
2
  Layout functions, currently limited to trees.
3
3
  """
4
4
 
5
- from typing import Any
5
+ from typing import (
6
+ Any,
7
+ Optional,
8
+ )
6
9
  from collections.abc import (
7
10
  Hashable,
8
11
  Callable,
@@ -99,6 +102,8 @@ def _horizontal_tree_layout_right(
99
102
 
100
103
  def _horizontal_tree_layout(
101
104
  orientation="right",
105
+ start: tuple[float, float] = (0, 0),
106
+ span: Optional[float] = None,
102
107
  **kwargs,
103
108
  ) -> dict[Hashable, list[float]]:
104
109
  """Horizontal tree layout."""
@@ -110,11 +115,24 @@ def _horizontal_tree_layout(
110
115
  if orientation == "left":
111
116
  for key in layout:
112
117
  layout[key][0] *= -1
118
+
119
+ if span is not None:
120
+ cur_span = len(layout) - 1
121
+ for key in layout:
122
+ layout[key][1] = float(layout[key][1]) * span / cur_span
123
+
124
+ if start != (0, 0):
125
+ for key in layout:
126
+ layout[key][0] += start[0]
127
+ layout[key][1] += start[1]
128
+
113
129
  return layout
114
130
 
115
131
 
116
132
  def _vertical_tree_layout(
117
133
  orientation="descending",
134
+ start: tuple[float, float] = (0, 0),
135
+ span: Optional[float] = None,
118
136
  **kwargs,
119
137
  ) -> dict[Hashable, list[float]]:
120
138
  """Vertical tree layout."""
@@ -125,6 +143,17 @@ def _vertical_tree_layout(
125
143
  layout[key] = value[::-1]
126
144
  # Orient vertically
127
145
  layout[key][1] *= sign
146
+
147
+ if span is not None:
148
+ cur_span = len(layout) - 1
149
+ for key in layout:
150
+ layout[key][0] = float(layout[key][0]) * span / cur_span
151
+
152
+ if start != (0, 0):
153
+ for key in layout:
154
+ layout[key][0] += start[0]
155
+ layout[key][1] += start[1]
156
+
128
157
  return layout
129
158
 
130
159
 
iplotx/version.py CHANGED
@@ -2,4 +2,4 @@
2
2
  iplotx version information module.
3
3
  """
4
4
 
5
- __version__ = "1.0.1"
5
+ __version__ = "1.1.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iplotx
3
- Version: 1.0.1
3
+ Version: 1.1.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
@@ -1,10 +1,10 @@
1
1
  iplotx/__init__.py,sha256=RzSct91jO8abrxOIn33rKEnDUgYpu1oj4olbObgX_hs,489
2
2
  iplotx/artists.py,sha256=2dBDT240zGwKb6tIc_y9pXeyU3LuYeF9wjj2tvi4KJo,730
3
3
  iplotx/label.py,sha256=7eS8ByadrhdIFOZz19U4VrS-oXY_ndFYNB-D4RZbFqI,9573
4
- iplotx/layout.py,sha256=KxmRLqjo8AYCBAmXez8rIiLU2sM34qhb6ox9AHYwRyE,4839
4
+ iplotx/layout.py,sha256=S-iFxHaIOzhBDG2JUzl9_oDBRP5TYY1hXnEOs0h1Rck,5588
5
5
  iplotx/plotting.py,sha256=FvV33DCuEjJwO9ytiYJuQmfOywgF-cDANd6nEE5s8R0,13211
6
6
  iplotx/typing.py,sha256=QLdzV358IiD1CFe88MVp0D77FSx5sSAVUmM_2WPPE8I,1463
7
- iplotx/version.py,sha256=V7W0rXi0DhtuwovCU4hLuXqTV7XgZp0IPed9QF9xUso,66
7
+ iplotx/version.py,sha256=mrnbNTnvhHXH5H10Drqi5HLqPXOwoyNlRYIAv7vTAy0,66
8
8
  iplotx/vertex.py,sha256=_yYyvusn4vYvi6RBEW6CHa3vnbv43GnZylnMIaK4bG0,16040
9
9
  iplotx/art3d/vertex.py,sha256=Xf8Um30X2doCd8KdNN7332F6BxC4k72Mb_GeRAuzQfQ,2545
10
10
  iplotx/art3d/edge/__init__.py,sha256=uw1U_mMXqcZAvea-7JbU1PUKULQD1CMMrbwY02tiWRQ,8529
@@ -40,6 +40,6 @@ iplotx/utils/geometry.py,sha256=6RrC6qaB0-1vIk1LhGA4CfsiMd-9JNniSPyL_l9mshE,9245
40
40
  iplotx/utils/internal.py,sha256=WWfcZDGK8Ut1y_tOHRGg9wSqY1bwSeLQO7dHM_8Tvwo,107
41
41
  iplotx/utils/matplotlib.py,sha256=p_53Oamof0RI4mtV8HrdDtZbgVqUxeUZ_KDvLZSiBUQ,8604
42
42
  iplotx/utils/style.py,sha256=vyNP80nDYVinqm6_9ltCJCtjK35ZcGlHvOskNv3eQBc,4225
43
- iplotx-1.0.1.dist-info/METADATA,sha256=jxmMX1X7reQl_O0RJ1GtOS1kT0p8Nkkwoa7rTEwX3QQ,5053
44
- iplotx-1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
45
- iplotx-1.0.1.dist-info/RECORD,,
43
+ iplotx-1.1.0.dist-info/METADATA,sha256=BBWbFLjqgs00VaB3DXNSex39oA0iDplDgBeCmrO6hKw,5053
44
+ iplotx-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
45
+ iplotx-1.1.0.dist-info/RECORD,,
File without changes