Skip to content

Commit b77c396

Browse files
committed
better plots
1 parent 097bd4f commit b77c396

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

tests/bending.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
import polyfempy as pf
4-
import utils
4+
from .utils import plot
55
import os
66

77

@@ -42,7 +42,7 @@ def test_run(self):
4242
vertices = pts + disp
4343
mises, _ = solver.get_sampled_mises_avg()
4444

45-
utils.plot(vertices, tets, mises)
45+
plot(vertices, tets, mises)
4646

4747

4848

tests/inflation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import polyfempy as pf
44
import numpy as np
55

6-
import utils
6+
from .utils import plot
77

88
import os
99

@@ -16,7 +16,6 @@ def test_run(self):
1616
dir_path = os.path.dirname(os.path.realpath(__file__))
1717
mesh_path = os.path.join(dir_path, "../3rdparty/data/circle2.msh")
1818
print(mesh_path)
19-
output = "inflation.obj"
2019

2120
settings = pf.Settings()
2221
settings.discr_order = 2
@@ -72,7 +71,7 @@ def test_run(self):
7271
for i in range(len(vv)):
7372
vv[i] = np.array([vertices[i][0], vertices[i][1], sol[resi[i]][0]])
7473

75-
utils.plot(vv, faces, None)
74+
plot(vv, faces, None)
7675

7776
# #save obj
7877
# with open(output, "w") as file:

tests/plane_hole.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
import polyfempy as pf
4-
import utils
4+
from .utils import plot
55
import os
66

77

@@ -42,7 +42,7 @@ def test_run(self):
4242
vertices = pts + disp
4343
mises, _ = solver.get_sampled_mises_avg()
4444

45-
utils.plot(vertices, tets, mises)
45+
plot(vertices, tets, mises)
4646

4747

4848

tests/torsion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
import polyfempy as pf
4-
import utils
4+
from .utils import plot
55

66
import os
77

@@ -47,7 +47,7 @@ def test_run(self):
4747
vertices = pts + disp
4848
mises, _ = solver.get_sampled_mises_avg()
4949

50-
utils.plot(vertices, tets, mises)
50+
plot(vertices, tets, mises)
5151

5252

5353
if __name__ == '__main__':

tests/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ def plot(vertices, connectivity, function):
2626
mesh = go.Mesh3d(x=x, y=y, z=z,
2727
i=f[:,0], j=f[:,1], k=f[:,2],
2828
intensity=function, flatshading=function is not None,
29-
hoverinfo="none")
29+
colorscale='Viridis',
30+
contour=dict(show=True, color='#fff'),
31+
hoverinfo="all")
3032
layout = go.Layout(scene=go.layout.Scene(aspectmode='data'))
3133
fig = go.Figure(data=[mesh], layout=layout)
3234

0 commit comments

Comments
 (0)