Skip to content

Commit 0fb326c

Browse files
committed
add a test class for the quiver plot. add asimple test for the 'scaleratio' param.
1 parent ee40b82 commit 0fb326c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

plotly/tests/test_optional/test_figure_factory/test_figure_factory.py

+40
Original file line numberDiff line numberDiff line change
@@ -2848,3 +2848,43 @@ def test_full_choropleth(self):
28482848
]
28492849

28502850
self.assertEqual(fig['data'][2]['x'][:50], exp_fig_head)
2851+
2852+
class TestQuiver(TestCase):
2853+
2854+
def test_scaleratio_param(self):
2855+
x,y = np.meshgrid(np.arange(0.5, 3.5, .5), np.arange(0.5, 4.5, .5))
2856+
u = x
2857+
v = y
2858+
angle = np.arctan(v / u)
2859+
norm = 0.25
2860+
u = norm * np.cos(angle)
2861+
v = norm * np.sin(angle)
2862+
fig = create_quiver(x, y, u, v, scale = 1, scaleratio = 0.5)
2863+
2864+
exp_fig_head = [(
2865+
0.5,
2866+
0.5883883476483185,
2867+
None,
2868+
1.0,
2869+
1.1118033988749896,
2870+
None,
2871+
1.5,
2872+
1.6185854122563141,
2873+
None,
2874+
2.0),
2875+
(0.5,
2876+
0.6767766952966369,
2877+
None,
2878+
0.5,
2879+
0.6118033988749895,
2880+
None,
2881+
0.5,
2882+
0.5790569415042095,
2883+
None,
2884+
0.5)]
2885+
2886+
fig_head = [fig['data'][0]['x'][:10], fig['data'][0]['y'][:10]]
2887+
2888+
self.assertEqual(fig_head, exp_fig_head)
2889+
2890+

0 commit comments

Comments
 (0)