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

Skip to content

Commit ccc6eb3

Browse files
committed
Fix trisurf test
1 parent 88a0239 commit ccc6eb3

File tree

1 file changed

+88
-58
lines changed

1 file changed

+88
-58
lines changed

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 88 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -842,72 +842,102 @@ def test_trisurf_all_args(self):
842842
)
843843

844844
exp_trisurf_plot = {
845-
'data': [
846-
{
847-
'facecolor': ['rgb(144.0, 94.5, 132.0)',
848-
'rgb(23.0, 190.0, 207.0)',
849-
'rgb(144.0, 94.5, 132.0)',
850-
'rgb(31.0, 119.0, 180.0)',
851-
'rgb(144.0, 94.5, 132.0)',
852-
'rgb(31.0, 119.0, 180.0)',
853-
'rgb(144.0, 94.5, 132.0)',
854-
'rgb(23.0, 190.0, 207.0)'],
855-
'i': [3, 1, 1, 5, 7, 3, 5, 7],
856-
'j': [1, 3, 5, 1, 3, 7, 7, 5],
857-
'k': [4, 0, 4, 2, 4, 6, 4, 8],
858-
'name': '',
859-
'type': 'mesh3d',
860-
'x': np.array([-1., 0., 1., -1., 0., 1., -1., 0., 1.]),
861-
'y': np.array([-1., -1., -1., 0., 0., 0., 1., 1., 1.]),
862-
'z': np.array([ 1., -0., -1., -0., 0., 0., -1., 0., 1.])
863-
},
864-
{
865-
'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
866-
'mode': 'lines',
867-
'type': 'scatter3d',
868-
'x': [-1.0, 0.0, 0.0, -1.0, None, 0.0, -1.0, -1.0, 0.0, None,
869-
0.0, 1.0, 0.0, 0.0, None, 1.0, 0.0, 1.0, 1.0, None, 0.0,
870-
-1.0, 0.0, 0.0, None, -1.0, 0.0, -1.0, -1.0, None, 1.0,
871-
0.0, 0.0, 1.0, None, 0.0, 1.0, 1.0, 0.0, None],
872-
'y': [0.0, -1.0, 0.0, 0.0, None, -1.0, 0.0, -1.0, -1.0, None,
873-
-1.0, 0.0, 0.0, -1.0, None, 0.0, -1.0, -1.0, 0.0, None,
874-
1.0, 0.0, 0.0, 1.0, None, 0.0, 1.0, 1.0, 0.0, None, 0.0,
875-
1.0, 0.0, 0.0, None, 1.0, 0.0, 1.0, 1.0, None],
876-
'z': [-0.0, -0.0, 0.0, -0.0, None, -0.0, -0.0, 1.0, -0.0,
877-
None, -0.0, 0.0, 0.0, -0.0, None, 0.0, -0.0, -1.0, 0.0,
878-
None, 0.0, -0.0, 0.0, 0.0, None, -0.0, 0.0, -1.0, -0.0,
879-
None, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 1.0, 0.0, None]
880-
}
881-
],
882-
'layout': {
883-
'height': 800,
884-
'scene': {'aspectratio': {'x': 1, 'y': 1, 'z': 1},
885-
'xaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
886-
'gridcolor': 'rgb(255, 255, 255)',
887-
'showbackground': True,
888-
'zerolinecolor': 'rgb(255, 255, 255)'},
889-
'yaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
890-
'gridcolor': 'rgb(255, 255, 255)',
891-
'showbackground': True,
892-
'zerolinecolor': 'rgb(255, 255, 255)'},
893-
'zaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
894-
'gridcolor': 'rgb(255, 255, 255)',
895-
'showbackground': True,
896-
'zerolinecolor': 'rgb(255, 255, 255)'}},
897-
'title': 'Trisurf Plot',
898-
'width': 800
899-
}
845+
'data': [{'facecolor': np.array(
846+
['rgb(145.0, 96.0, 143.0)',
847+
'rgb(29.0, 190.0, 201.0)',
848+
'rgb(145.0, 96.0, 143.0)',
849+
'rgb(31.0, 119.0, 180.0)',
850+
'rgb(145.0, 96.0, 143.0)',
851+
'rgb(31.0, 119.0, 180.0)',
852+
'rgb(145.0, 96.0, 143.0)',
853+
'rgb(29.0, 190.0, 201.0)'],
854+
dtype='|S23'
855+
),
856+
'i': np.array([3, 1, 1, 5, 7, 3, 5, 7], dtype='int32'),
857+
'j': np.array([1, 3, 5, 1, 3, 7, 7, 5], dtype='int32'),
858+
'k': np.array([4, 0, 4, 2, 4, 6, 4, 8], dtype='int32'),
859+
'name': '',
860+
'type': 'mesh3d',
861+
'x': np.array([-1., 0., 1., -1., 0., 1.,
862+
-1., 0., 1.]),
863+
'y': np.array([-1., -1., -1., 0., 0., 0.,
864+
1., 1., 1.]),
865+
'z': np.array([1., -0., -1., -0., 0., 0.,
866+
-1., 0., 1.])},
867+
{'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
868+
'mode': 'lines',
869+
'type': 'scatter3d',
870+
'x': np.array([-1.0, 0.0, 0.0, -1.0, None, 0.0, -1.0,
871+
-1.0, 0.0, None, 0.0, 1.0, 0.0, 0.0,
872+
None, 1.0, 0.0, 1.0, 1.0, None, 0.0,
873+
-1.0, 0.0, 0.0, None, -1.0, 0.0, -1.0,
874+
-1.0, None, 1.0, 0.0, 0.0, 1.0, None,
875+
0.0, 1.0, 1.0, 0.0, None], dtype=object),
876+
'y': np.array([0.0, -1.0, 0.0, 0.0, None, -1.0, 0.0,
877+
-1.0, -1.0, None, -1.0, 0.0, 0.0, -1.0,
878+
None, 0.0, -1.0, -1.0, 0.0, None, 1.0,
879+
0.0, 0.0, 1.0, None, 0.0, 1.0, 1.0, 0.0,
880+
None, 0.0, 1.0, 0.0, 0.0, None, 1.0, 0.0,
881+
1.0, 1.0, None], dtype=object),
882+
'z': np.array([-0.0, -0.0, 0.0, -0.0, None, -0.0, -0.0,
883+
1.0, -0.0, None, -0.0, 0.0, 0.0, -0.0,
884+
None, 0.0, -0.0, -1.0, 0.0, None, 0.0,
885+
-0.0, 0.0, 0.0, None, -0.0, 0.0, -1.0,
886+
-0.0, None, 0.0, 0.0, 0.0, 0.0, None,
887+
0.0, 0.0, 1.0, 0.0, None], dtype=object)},
888+
{'colorscale': [[0.0, 'rgb(31.0, 119.0, 180.0)'],
889+
[0.1111111111111111, 'rgb(255.0, 127.0, 14.0)'],
890+
[0.2222222222222222, 'rgb(44.0, 160.0, 44.0)'],
891+
[0.3333333333333333, 'rgb(214.0, 39.0, 40.0)'],
892+
[0.4444444444444444, 'rgb(148.0, 103.0, 189.0)'],
893+
[0.5555555555555556, 'rgb(140.0, 86.0, 75.0)'],
894+
[0.6666666666666666, 'rgb(227.0, 119.0, 194.0)'],
895+
[0.7777777777777778, 'rgb(127.0, 127.0, 127.0)'],
896+
[0.8888888888888888, 'rgb(188.0, 189.0, 34.0)'],
897+
[1.0, 'rgb(23.0, 190.0, 207.0)']],
898+
'intensity': [0, 1],
899+
'showscale': True,
900+
'type': 'mesh3d',
901+
'x': [0, 1],
902+
'y': [0, 1],
903+
'z': [0, 1]}],
904+
'layout': {'height': 800,
905+
'scene': {'aspectratio': {'x': 1, 'y': 1, 'z': 1},
906+
'xaxis': {'backgroundcolor':
907+
'rgb(230, 230, 230)',
908+
'gridcolor':
909+
'rgb(255, 255, 255)',
910+
'showbackground': True,
911+
'zerolinecolor':
912+
'rgb(255, 255, 255)'},
913+
'yaxis': {'backgroundcolor':
914+
'rgb(230, 230, 230)',
915+
'gridcolor': 'rgb(255, 255, 255)',
916+
'showbackground': True,
917+
'zerolinecolor':
918+
'rgb(255, 255, 255)'},
919+
'zaxis': {'backgroundcolor':
920+
'rgb(230, 230, 230)',
921+
'gridcolor': 'rgb(255, 255, 255)',
922+
'showbackground': True,
923+
'zerolinecolor':
924+
'rgb(255, 255, 255)'}},
925+
'title': 'Trisurf Plot',
926+
'width': 800}
900927
}
901928

902-
self.assert_dict_equal(test_trisurf_plot['layout'],
903-
exp_trisurf_plot['layout'])
904-
905929
self.assert_dict_equal(test_trisurf_plot['data'][0],
906930
exp_trisurf_plot['data'][0])
907931

908932
self.assert_dict_equal(test_trisurf_plot['data'][1],
909933
exp_trisurf_plot['data'][1])
910934

935+
self.assert_dict_equal(test_trisurf_plot['data'][2],
936+
exp_trisurf_plot['data'][2])
937+
938+
self.assert_dict_equal(test_trisurf_plot['layout'],
939+
exp_trisurf_plot['layout'])
940+
911941
# Test passing custom colors
912942
colors_raw = np.random.randn(simplices.shape[0])
913943
colors_str = ['rgb(%s, %s, %s)' % (i, j, k)

0 commit comments

Comments
 (0)