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

Skip to content

Commit 59d8953

Browse files
committed
New expected_trisurf_plot data
1 parent f7c1369 commit 59d8953

File tree

1 file changed

+164
-169
lines changed

1 file changed

+164
-169
lines changed

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 164 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -622,191 +622,186 @@ def test_valid_colormap(self):
622622
def test_trisurf_all_args(self):
623623

624624
# check if trisurf plot matches with expected output
625-
u = np.linspace(-np.pi, np.pi, 3)
626-
v = np.linspace(-np.pi, np.pi, 3)
625+
u = np.linspace(-1, 1, 3)
626+
v = np.linspace(-1, 1, 3)
627627
u, v = np.meshgrid(u, v)
628628
u = u.flatten()
629629
v = v.flatten()
630630

631631
x = u
632-
y = u*np.cos(v)
633-
z = u*np.sin(v)
632+
y = v
633+
z = u*v
634634

635635
points2D = np.vstack([u, v]).T
636636
tri = Delaunay(points2D)
637637
simplices = tri.simplices
638638

639639
test_trisurf_plot = tls.FigureFactory.create_trisurf(
640-
x, y, z, simplices, colormap='Blues',
640+
x, y, z, simplices, colormap=[(0, 0, 0), (1, 1, 1)],
641641
title='Fun',
642642
showbackground=False,
643-
backgroundcolor='rgb(1, 20, 10)',
644-
gridcolor='rgb(0, 20, 50)',
645-
zerolinecolor='rgb(25, 255, 15)',
643+
backgroundcolor='rgb(1, 1, 1)',
644+
gridcolor='rgb(2, 2, 2)',
645+
zerolinecolor='rgb(3, 3, 3)',
646646
height=500, width=500,
647647
aspectratio=dict(x=0.7, y=0.6, z=1.2)
648648
)
649-
exp_trisurf_plot = {'data': [{'facecolor': ['rgb(112.5, 115.00000000000001, 196.0)',
650-
'rgb(220.0, 220.0, 220.0)',
651-
'rgb(112.5, 115.00000000000001, 196.0)',
652-
'rgb(5.0, 10.0, 172.0)',
653-
'rgb(112.5, 115.00000000000001, 196.0)',
654-
'rgb(5.0, 10.0, 172.0)',
655-
'rgb(112.5, 115.00000000000001, 196.0)',
656-
'rgb(220.0, 220.0, 220.0)'],
657-
'i': [3, 1, 1, 5, 7, 3, 5, 7],
658-
'j': [1, 3, 5, 1, 3, 7, 7, 5],
659-
'k': [4, 0, 4, 2, 4, 6, 4, 8],
660-
'name': '',
661-
'type': 'mesh3d',
662-
'x': np.array([-3.14159265, 0. , 3.14159265, -3.14159265, 0. ,
663-
3.14159265, -3.14159265, 0. , 3.14159265]),
664-
'y': np.array([ 3.14159265, -0. , -3.14159265, -3.14159265, 0. ,
665-
3.14159265, 3.14159265, -0. , -3.14159265]),
666-
'z': np.array([ 3.84734139e-16, -0.00000000e+00, -3.84734139e-16,
667-
-0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
668-
-3.84734139e-16, 0.00000000e+00, 3.84734139e-16])},
669-
{'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
670-
'mode': 'lines',
671-
'type': 'scatter3d',
672-
'x': [-3.1415926535897931,
673-
0.0,
674-
0.0,
675-
-3.1415926535897931,
676-
None,
677-
0.0,
678-
-3.1415926535897931,
679-
-3.1415926535897931,
680-
0.0,
681-
None,
682-
0.0,
683-
3.1415926535897931,
684-
0.0,
685-
0.0,
686-
None,
687-
3.1415926535897931,
688-
0.0,
689-
3.1415926535897931,
690-
3.1415926535897931,
691-
None,
692-
0.0,
693-
-3.1415926535897931,
694-
0.0,
695-
0.0,
696-
None,
697-
-3.1415926535897931,
698-
0.0,
699-
-3.1415926535897931,
700-
-3.1415926535897931,
701-
None,
702-
3.1415926535897931,
703-
0.0,
704-
0.0,
705-
3.1415926535897931,
706-
None,
707-
0.0,
708-
3.1415926535897931,
709-
3.1415926535897931,
710-
0.0,
711-
None],
712-
'y': [-3.1415926535897931,
713-
-0.0,
714-
0.0,
715-
-3.1415926535897931,
716-
None,
717-
-0.0,
718-
-3.1415926535897931,
719-
3.1415926535897931,
720-
-0.0,
721-
None,
722-
-0.0,
723-
3.1415926535897931,
724-
0.0,
725-
-0.0,
726-
None,
727-
3.1415926535897931,
728-
-0.0,
729-
-3.1415926535897931,
730-
3.1415926535897931,
731-
None,
732-
-0.0,
733-
-3.1415926535897931,
734-
0.0,
735-
-0.0,
736-
None,
737-
-3.1415926535897931,
738-
-0.0,
739-
3.1415926535897931,
740-
-3.1415926535897931,
741-
None,
742-
3.1415926535897931,
743-
-0.0,
744-
0.0,
745-
3.1415926535897931,
746-
None,
747-
-0.0,
748-
3.1415926535897931,
749-
-3.1415926535897931,
750-
-0.0,
751-
None],
752-
'z': [-0.0,
753-
-0.0,
754-
0.0,
755-
-0.0,
756-
None,
757-
-0.0,
758-
-0.0,
759-
3.8473413874435795e-16,
760-
-0.0,
761-
None,
762-
-0.0,
763-
0.0,
764-
0.0,
765-
-0.0,
766-
None,
767-
0.0,
768-
-0.0,
769-
-3.8473413874435795e-16,
770-
0.0,
771-
None,
772-
0.0,
773-
-0.0,
774-
0.0,
775-
0.0,
776-
None,
777-
-0.0,
778-
0.0,
779-
-3.8473413874435795e-16,
780-
-0.0,
781-
None,
782-
0.0,
783-
0.0,
784-
0.0,
785-
0.0,
786-
None,
787-
0.0,
788-
0.0,
789-
3.8473413874435795e-16,
790-
0.0,
791-
None]}],
792-
'layout': {'height': 500,
793-
'scene': {'aspectratio': {'x': 0.7, 'y': 0.6, 'z': 1.2},
794-
'xaxis': {'backgroundcolor': 'rgb(1, 20, 10)',
795-
'gridcolor': 'rgb(0, 20, 50)',
796-
'showbackground': False,
797-
'zerolinecolor': 'rgb(25, 255, 15)'},
798-
'yaxis': {'backgroundcolor': 'rgb(1, 20, 10)',
799-
'gridcolor': 'rgb(0, 20, 50)',
800-
'showbackground': False,
801-
'zerolinecolor': 'rgb(25, 255, 15)'},
802-
'zaxis': {'backgroundcolor': 'rgb(1, 20, 10)',
803-
'gridcolor': 'rgb(0, 20, 50)',
804-
'showbackground': False,
805-
'zerolinecolor': 'rgb(25, 255, 15)'}},
806-
'title': 'Fun',
807-
'width': 500}}
808-
809-
#self.assertEqual(test_trisurf_plot['data'], exp_trisurf_plot['data'])
649+
650+
exp_trisurf_plot = {'data': [{'facecolor': ['rgb(127.5, 127.5, 127.5)',
651+
'rgb(255.0, 255.0, 255.0)',
652+
'rgb(127.5, 127.5, 127.5)',
653+
'rgb(0.0, 0.0, 0.0)',
654+
'rgb(127.5, 127.5, 127.5)',
655+
'rgb(0.0, 0.0, 0.0)',
656+
'rgb(127.5, 127.5, 127.5)',
657+
'rgb(255.0, 255.0, 255.0)'],
658+
'i': [3, 1, 1, 5, 7, 3, 5, 7],
659+
'j': [1, 3, 5, 1, 3, 7, 7, 5],
660+
'k': [4, 0, 4, 2, 4, 6, 4, 8],
661+
'name': '',
662+
'type': 'mesh3d',
663+
'x': np.array([-1., 0., 1., -1., 0., 1., -1., 0., 1.]),
664+
'y': np.array([-1., -1., -1., 0., 0., 0., 1., 1., 1.]),
665+
'z': np.array([ 1., -0., -1., -0., 0., 0., -1., 0., 1.])},
666+
{'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
667+
'mode': 'lines',
668+
'type': 'scatter3d',
669+
'x': [-1.0,
670+
0.0,
671+
0.0,
672+
-1.0,
673+
None,
674+
0.0,
675+
-1.0,
676+
-1.0,
677+
0.0,
678+
None,
679+
0.0,
680+
1.0,
681+
0.0,
682+
0.0,
683+
None,
684+
1.0,
685+
0.0,
686+
1.0,
687+
1.0,
688+
None,
689+
0.0,
690+
-1.0,
691+
0.0,
692+
0.0,
693+
None,
694+
-1.0,
695+
0.0,
696+
-1.0,
697+
-1.0,
698+
None,
699+
1.0,
700+
0.0,
701+
0.0,
702+
1.0,
703+
None,
704+
0.0,
705+
1.0,
706+
1.0,
707+
0.0,
708+
None],
709+
'y': [0.0,
710+
-1.0,
711+
0.0,
712+
0.0,
713+
None,
714+
-1.0,
715+
0.0,
716+
-1.0,
717+
-1.0,
718+
None,
719+
-1.0,
720+
0.0,
721+
0.0,
722+
-1.0,
723+
None,
724+
0.0,
725+
-1.0,
726+
-1.0,
727+
0.0,
728+
None,
729+
1.0,
730+
0.0,
731+
0.0,
732+
1.0,
733+
None,
734+
0.0,
735+
1.0,
736+
1.0,
737+
0.0,
738+
None,
739+
0.0,
740+
1.0,
741+
0.0,
742+
0.0,
743+
None,
744+
1.0,
745+
0.0,
746+
1.0,
747+
1.0,
748+
None],
749+
'z': [-0.0,
750+
-0.0,
751+
0.0,
752+
-0.0,
753+
None,
754+
-0.0,
755+
-0.0,
756+
1.0,
757+
-0.0,
758+
None,
759+
-0.0,
760+
0.0,
761+
0.0,
762+
-0.0,
763+
None,
764+
0.0,
765+
-0.0,
766+
-1.0,
767+
0.0,
768+
None,
769+
0.0,
770+
-0.0,
771+
0.0,
772+
0.0,
773+
None,
774+
-0.0,
775+
0.0,
776+
-1.0,
777+
-0.0,
778+
None,
779+
0.0,
780+
0.0,
781+
0.0,
782+
0.0,
783+
None,
784+
0.0,
785+
0.0,
786+
1.0,
787+
0.0,
788+
None]}],
789+
'layout': {'height': 500,
790+
'scene': {'aspectratio': {'x': 0.7, 'y': 0.6, 'z': 1.2},
791+
'xaxis': {'backgroundcolor': 'rgb(1, 1, 1)',
792+
'gridcolor': 'rgb(2, 2, 2)',
793+
'showbackground': False,
794+
'zerolinecolor': 'rgb(3, 3, 3)'},
795+
'yaxis': {'backgroundcolor': 'rgb(1, 1, 1)',
796+
'gridcolor': 'rgb(2, 2, 2)',
797+
'showbackground': False,
798+
'zerolinecolor': 'rgb(3, 3, 3)'},
799+
'zaxis': {'backgroundcolor': 'rgb(1, 1, 1)',
800+
'gridcolor': 'rgb(2, 2, 2)',
801+
'showbackground': False,
802+
'zerolinecolor': 'rgb(3, 3, 3)'}},
803+
'title': 'Fun',
804+
'width': 500}}
810805

811806
self.assert_dict_equal(test_trisurf_plot['data'][0],
812807
exp_trisurf_plot['data'][0])

0 commit comments

Comments
 (0)