Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit baec606

Browse files
committed
asd
1 parent 44f4c9f commit baec606

File tree

2 files changed

+171
-9
lines changed

2 files changed

+171
-9
lines changed

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ def test_trisurf_all_args(self):
636636
tri = Delaunay(points2D)
637637
simplices = tri.simplices
638638

639+
test_trisurf_plot = tls.FigureFactory.create_trisurf(x, y, z, simplices)
640+
641+
"""
639642
test_trisurf_plot = tls.FigureFactory.create_trisurf(
640643
x, y, z, simplices, colormap=[(0, 0, 0), (1, 1, 1)],
641644
title='Fun',
@@ -646,7 +649,166 @@ def test_trisurf_all_args(self):
646649
height=500, width=500,
647650
aspectratio=dict(x=0.7, y=0.6, z=1.2)
648651
)
649-
652+
"""
653+
654+
exp_trisurf_plot = {'data': [{'facecolor': ['rgb(143.0, 123.0, 97.000000000000014)',
655+
'rgb(255.0, 127.0, 14.000000000000007)',
656+
'rgb(143.0, 123.0, 97.000000000000014)',
657+
'rgb(31.0, 119.0, 180.0)',
658+
'rgb(143.0, 123.0, 97.000000000000014)',
659+
'rgb(31.0, 119.0, 180.0)',
660+
'rgb(143.0, 123.0, 97.000000000000014)',
661+
'rgb(255.0, 127.0, 14.000000000000007)'],
662+
'i': [3, 1, 1, 5, 7, 3, 5, 7],
663+
'j': [1, 3, 5, 1, 3, 7, 7, 5],
664+
'k': [4, 0, 4, 2, 4, 6, 4, 8],
665+
'name': '',
666+
'type': 'mesh3d',
667+
'x': np.array([-1., 0., 1., -1., 0., 1., -1., 0., 1.]),
668+
'y': np.array([-1., -1., -1., 0., 0., 0., 1., 1., 1.]),
669+
'z': np.array([ 1., -0., -1., -0., 0., 0., -1., 0., 1.])},
670+
{'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
671+
'mode': 'lines',
672+
'type': 'scatter3d',
673+
'x': [-1.0,
674+
0.0,
675+
0.0,
676+
-1.0,
677+
None,
678+
0.0,
679+
-1.0,
680+
-1.0,
681+
0.0,
682+
None,
683+
0.0,
684+
1.0,
685+
0.0,
686+
0.0,
687+
None,
688+
1.0,
689+
0.0,
690+
1.0,
691+
1.0,
692+
None,
693+
0.0,
694+
-1.0,
695+
0.0,
696+
0.0,
697+
None,
698+
-1.0,
699+
0.0,
700+
-1.0,
701+
-1.0,
702+
None,
703+
1.0,
704+
0.0,
705+
0.0,
706+
1.0,
707+
None,
708+
0.0,
709+
1.0,
710+
1.0,
711+
0.0,
712+
None],
713+
'y': [0.0,
714+
-1.0,
715+
0.0,
716+
0.0,
717+
None,
718+
-1.0,
719+
0.0,
720+
-1.0,
721+
-1.0,
722+
None,
723+
-1.0,
724+
0.0,
725+
0.0,
726+
-1.0,
727+
None,
728+
0.0,
729+
-1.0,
730+
-1.0,
731+
0.0,
732+
None,
733+
1.0,
734+
0.0,
735+
0.0,
736+
1.0,
737+
None,
738+
0.0,
739+
1.0,
740+
1.0,
741+
0.0,
742+
None,
743+
0.0,
744+
1.0,
745+
0.0,
746+
0.0,
747+
None,
748+
1.0,
749+
0.0,
750+
1.0,
751+
1.0,
752+
None],
753+
'z': [-0.0,
754+
-0.0,
755+
0.0,
756+
-0.0,
757+
None,
758+
-0.0,
759+
-0.0,
760+
1.0,
761+
-0.0,
762+
None,
763+
-0.0,
764+
0.0,
765+
0.0,
766+
-0.0,
767+
None,
768+
0.0,
769+
-0.0,
770+
-1.0,
771+
0.0,
772+
None,
773+
0.0,
774+
-0.0,
775+
0.0,
776+
0.0,
777+
None,
778+
-0.0,
779+
0.0,
780+
-1.0,
781+
-0.0,
782+
None,
783+
0.0,
784+
0.0,
785+
0.0,
786+
0.0,
787+
None,
788+
0.0,
789+
0.0,
790+
1.0,
791+
0.0,
792+
None]}],
793+
'layout': {'height': 800,
794+
'scene': {'aspectratio': {'x': 1, 'y': 1, 'z': 1},
795+
'xaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
796+
'gridcolor': 'rgb(255, 255, 255)',
797+
'showbackground': True,
798+
'zerolinecolor': 'rgb(255, 255, 255)'},
799+
'yaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
800+
'gridcolor': 'rgb(255, 255, 255)',
801+
'showbackground': True,
802+
'zerolinecolor': 'rgb(255, 255, 255)'},
803+
'zaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
804+
'gridcolor': 'rgb(255, 255, 255)',
805+
'showbackground': True,
806+
'zerolinecolor': 'rgb(255, 255, 255)'}},
807+
'title': 'Trisurf Plot',
808+
'width': 800}}
809+
810+
811+
"""
650812
exp_trisurf_plot = {'data': [{'facecolor': ['rgb(127.5, 127.5, 127.5)',
651813
'rgb(255.0, 255.0, 255.0)',
652814
'rgb(127.5, 127.5, 127.5)',
@@ -802,6 +964,7 @@ def test_trisurf_all_args(self):
802964
'zerolinecolor': 'rgb(3, 3, 3)'}},
803965
'title': 'Fun',
804966
'width': 500}}
967+
"""
805968

806969
self.assert_dict_equal(test_trisurf_plot['layout'],
807970
exp_trisurf_plot['layout'])

plotly/tools.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,11 +1549,10 @@ def _tri_indices(simplices):
15491549

15501550
@staticmethod
15511551
def _trisurf(x, y, z, simplices, colormap=None,
1552-
plot_edges=None):
1552+
plot_edges=None, Xe=None, Ye=None, Ze=None):
15531553
"""
15541554
Refer to FigureFactory.create_trisurf() for docstring
15551555
"""
1556-
#Xe=None, Ye=None, Ze=None
15571556
# numpy import check
15581557
if _numpy_imported is False:
15591558
raise ImportError("FigureFactory._trisurf() requires "
@@ -1583,20 +1582,20 @@ def _trisurf(x, y, z, simplices, colormap=None,
15831582
# None separates data corresponding to two consecutive triangles
15841583
lists_coord = ([[[T[k % 3][c] for k in range(4)]+[None]
15851584
for T in tri_vertices] for c in range(3)])
1586-
#if Xe is None:
1587-
Xe = []
1585+
if Xe is None:
1586+
Xe = []
15881587
for array in lists_coord[0]:
15891588
for item in array:
15901589
Xe.append(item)
15911590

1592-
#if Ye is None:
1593-
Ye = []
1591+
if Ye is None:
1592+
Ye = []
15941593
for array in lists_coord[1]:
15951594
for item in array:
15961595
Ye.append(item)
15971596

1598-
#if Ze is None:
1599-
Ze = []
1597+
if Ze is None:
1598+
Ze = []
16001599
for array in lists_coord[2]:
16011600
for item in array:
16021601
Ze.append(item)

0 commit comments

Comments
 (0)