topologicpy 0.4.37__py3-none-any.whl → 0.4.38__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.
- topologicpy/Plotly.py +33 -24
- topologicpy/Topology.py +583 -603
- topologicpy/__init__.py +1 -1
- {topologicpy-0.4.37.dist-info → topologicpy-0.4.38.dist-info}/METADATA +1 -1
- {topologicpy-0.4.37.dist-info → topologicpy-0.4.38.dist-info}/RECORD +8 -8
- {topologicpy-0.4.37.dist-info → topologicpy-0.4.38.dist-info}/LICENSE +0 -0
- {topologicpy-0.4.37.dist-info → topologicpy-0.4.38.dist-info}/WHEEL +0 -0
- {topologicpy-0.4.37.dist-info → topologicpy-0.4.38.dist-info}/top_level.txt +0 -0
topologicpy/Plotly.py
CHANGED
|
@@ -388,7 +388,7 @@ class Plotly:
|
|
|
388
388
|
faceMinGroup=None, faceMaxGroup=None,
|
|
389
389
|
showFaceLegend=False, faceLegendLabel="Topology Faces", faceLegendRank=3,
|
|
390
390
|
faceLegendGroup=3,
|
|
391
|
-
intensityKey=None, colorScale="Viridis", tolerance=0.0001):
|
|
391
|
+
intensityKey=None, colorScale="Viridis", mantissa=4, tolerance=0.0001):
|
|
392
392
|
"""
|
|
393
393
|
Creates plotly face, edge, and vertex data.
|
|
394
394
|
|
|
@@ -493,6 +493,8 @@ class Plotly:
|
|
|
493
493
|
If not None, the dictionary of each vertex is searched for the value associated with the intensity key. This value is then used to color-code the vertex based on the colorScale. The default is None.
|
|
494
494
|
colorScale : str , optional
|
|
495
495
|
The desired type of plotly color scales to use (e.g. "Viridis", "Plasma"). The default is "Viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
|
496
|
+
mantissa : int , optional
|
|
497
|
+
The desired length of the mantissa. The default is 4.
|
|
496
498
|
tolerance : float , optional
|
|
497
499
|
The desired tolerance. The default is 0.0001.
|
|
498
500
|
|
|
@@ -528,9 +530,9 @@ class Plotly:
|
|
|
528
530
|
minGroup = 0
|
|
529
531
|
maxGroup = 1
|
|
530
532
|
for m, v in enumerate(vertices):
|
|
531
|
-
x.append(v[0])
|
|
532
|
-
y.append(v[1])
|
|
533
|
-
z.append(v[2])
|
|
533
|
+
x.append(round(v[0], mantissa))
|
|
534
|
+
y.append(round(v[1], mantissa))
|
|
535
|
+
z.append(round(v[2], mantissa))
|
|
534
536
|
label = ""
|
|
535
537
|
group = ""
|
|
536
538
|
if len(dictionaries) > 0:
|
|
@@ -560,9 +562,9 @@ class Plotly:
|
|
|
560
562
|
labels.append(label)
|
|
561
563
|
else:
|
|
562
564
|
for v in vertices:
|
|
563
|
-
x.append(v[0])
|
|
564
|
-
y.append(v[1])
|
|
565
|
-
z.append(v[2])
|
|
565
|
+
x.append(round(v[0], mantissa))
|
|
566
|
+
y.append(round(v[1], mantissa))
|
|
567
|
+
z.append(round(v[2], mantissa))
|
|
566
568
|
|
|
567
569
|
if len(list(set(groupList))) < 2:
|
|
568
570
|
groupList = color
|
|
@@ -607,9 +609,9 @@ class Plotly:
|
|
|
607
609
|
for m, e in enumerate(edges):
|
|
608
610
|
sv = vertices[e[0]]
|
|
609
611
|
ev = vertices[e[1]]
|
|
610
|
-
x+=[sv[0],ev[0], None] # x-coordinates of edge ends
|
|
611
|
-
y+=[sv[1],ev[1], None] # y-coordinates of edge ends
|
|
612
|
-
z+=[sv[2],ev[2], None] # z-coordinates of edge ends
|
|
612
|
+
x+=[round(sv[0],5),round(ev[0],mantissa), None] # x-coordinates of edge ends
|
|
613
|
+
y+=[round(sv[1],5),round(ev[1],mantissa), None] # y-coordinates of edge ends
|
|
614
|
+
z+=[round(sv[2],5),round(ev[2],mantissa), None] # z-coordinates of edge ends
|
|
613
615
|
label = ""
|
|
614
616
|
group = ""
|
|
615
617
|
if len(dictionaries) > 0:
|
|
@@ -641,9 +643,9 @@ class Plotly:
|
|
|
641
643
|
for e in edges:
|
|
642
644
|
sv = vertices[e[0]]
|
|
643
645
|
ev = vertices[e[1]]
|
|
644
|
-
x+=[sv[0],ev[0], None] # x-coordinates of edge ends
|
|
645
|
-
y+=[sv[1],ev[1], None] # y-coordinates of edge ends
|
|
646
|
-
z+=[sv[2],ev[2], None] # z-coordinates of edge ends
|
|
646
|
+
x+=[round(sv[0],mantissa),round(ev[0],mantissa), None] # x-coordinates of edge ends
|
|
647
|
+
y+=[round(sv[1],mantissa),round(ev[1],mantissa), None] # y-coordinates of edge ends
|
|
648
|
+
z+=[round(sv[2],mantissa),round(ev[2],mantissa), None] # z-coordinates of edge ends
|
|
647
649
|
|
|
648
650
|
if len(list(set(groupList))) < 2:
|
|
649
651
|
groupList = color
|
|
@@ -668,9 +670,9 @@ class Plotly:
|
|
|
668
670
|
y = []
|
|
669
671
|
z = []
|
|
670
672
|
for v in vertices:
|
|
671
|
-
x.append(v[0])
|
|
672
|
-
y.append(v[1])
|
|
673
|
-
z.append(v[2])
|
|
673
|
+
x.append(round(v[0], mantissa))
|
|
674
|
+
y.append(round(v[1], mantissa))
|
|
675
|
+
z.append(round(v[2], mantissa))
|
|
674
676
|
i = []
|
|
675
677
|
j = []
|
|
676
678
|
k = []
|
|
@@ -951,7 +953,8 @@ class Plotly:
|
|
|
951
953
|
marginLeft=0,
|
|
952
954
|
marginRight=0,
|
|
953
955
|
marginTop=40,
|
|
954
|
-
marginBottom=0
|
|
956
|
+
marginBottom=0,
|
|
957
|
+
mantissa=4):
|
|
955
958
|
"""
|
|
956
959
|
Returns a Plotly Figure of the input matrix.
|
|
957
960
|
|
|
@@ -997,6 +1000,8 @@ class Plotly:
|
|
|
997
1000
|
The desired top margin in pixels. The default is 40.
|
|
998
1001
|
marginBottom : int , optional
|
|
999
1002
|
The desired bottom margin in pixels. The default is 0.
|
|
1003
|
+
mantissa : int , optional
|
|
1004
|
+
The desired number of digits of the mantissa. The default is 4.
|
|
1000
1005
|
|
|
1001
1006
|
"""
|
|
1002
1007
|
#import plotly.figure_factory as ff
|
|
@@ -1033,7 +1038,7 @@ class Plotly:
|
|
|
1033
1038
|
"font": {"color": "black"},
|
|
1034
1039
|
"bgcolor": "white",
|
|
1035
1040
|
"opacity": 0.5,
|
|
1036
|
-
"text": str(round(value,
|
|
1041
|
+
"text": str(round(value, mantissa)),
|
|
1037
1042
|
"xref": "x1",
|
|
1038
1043
|
"yref": "y1",
|
|
1039
1044
|
"showarrow": False
|
|
@@ -1054,7 +1059,7 @@ class Plotly:
|
|
|
1054
1059
|
"font": {"color": "black"},
|
|
1055
1060
|
"bgcolor": "white",
|
|
1056
1061
|
"opacity": 0.5,
|
|
1057
|
-
"text": str(round(value,
|
|
1062
|
+
"text": str(round(value,mantissa)),
|
|
1058
1063
|
"xref": "x1",
|
|
1059
1064
|
"yref": "y1",
|
|
1060
1065
|
"showarrow": False
|
|
@@ -1067,9 +1072,9 @@ class Plotly:
|
|
|
1067
1072
|
maxRow = sum(row)
|
|
1068
1073
|
for j in range(len(row)):
|
|
1069
1074
|
if maxRow == 0:
|
|
1070
|
-
new_row.append(round(0,
|
|
1075
|
+
new_row.append(round(0, mantissa))
|
|
1071
1076
|
else:
|
|
1072
|
-
new_row.append(round(float(row[j])/float(maxRow),
|
|
1077
|
+
new_row.append(round(float(row[j])/float(maxRow), mantissa))
|
|
1073
1078
|
new_matrix.append(new_row)
|
|
1074
1079
|
data = go.Heatmap(z=new_matrix, y=yCategories, x=xCategories, zmin=minValue, zmax=maxValue, showscale=showScale, colorscale=colors)
|
|
1075
1080
|
|
|
@@ -1544,7 +1549,7 @@ class Plotly:
|
|
|
1544
1549
|
|
|
1545
1550
|
"""
|
|
1546
1551
|
if not isinstance(topology, topologic.Topology):
|
|
1547
|
-
print("
|
|
1552
|
+
print("Plotly.FigureByTopology - Error: the input topology is not a valid topology. Returning None.")
|
|
1548
1553
|
return None
|
|
1549
1554
|
data = Plotly.DataByTopology(topology=topology,
|
|
1550
1555
|
showVertices=showVertices, vertexSize=vertexSize, vertexColor=vertexColor,
|
|
@@ -1817,7 +1822,11 @@ class Plotly:
|
|
|
1817
1822
|
return None
|
|
1818
1823
|
if not camera == None:
|
|
1819
1824
|
figure = Plotly.SetCamera(figure, camera=camera, target=target, up=up)
|
|
1820
|
-
|
|
1825
|
+
if renderer.lower() == "offline":
|
|
1826
|
+
import plotly.offline as ofl
|
|
1827
|
+
ofl.plot(figure)
|
|
1828
|
+
else:
|
|
1829
|
+
figure.show(renderer=renderer)
|
|
1821
1830
|
return None
|
|
1822
1831
|
|
|
1823
1832
|
@staticmethod
|
|
@@ -1838,7 +1847,7 @@ class Plotly:
|
|
|
1838
1847
|
'notebook', 'notebook_connected', 'kaggle', 'azure', 'colab',
|
|
1839
1848
|
'cocalc', 'databricks', 'json', 'png', 'jpeg', 'jpg', 'svg',
|
|
1840
1849
|
'pdf', 'browser', 'firefox', 'chrome', 'chromium', 'iframe',
|
|
1841
|
-
'iframe_connected', 'sphinx_gallery', 'sphinx_gallery_png']
|
|
1850
|
+
'iframe_connected', 'sphinx_gallery', 'sphinx_gallery_png', 'offline']
|
|
1842
1851
|
|
|
1843
1852
|
@staticmethod
|
|
1844
1853
|
def ExportToImage(figure, path, format="png", width="1920", height="1080"):
|