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

Skip to content

Commit 2c2ff2d

Browse files
committed
Add test for quiverkey with multiple angles
1 parent d705dbd commit 2c2ff2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/tests/test_quiver.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,20 @@ def test_bad_masked_sizes():
161161
ax.barbs(x, y, u, v)
162162

163163

164+
def test_quiverkey_angles():
165+
# Check that only a single arrow is plotted for a quiverkey when an array
166+
# of angles is given to the original quiver plot
167+
fig, ax = plt.subplots()
168+
169+
X, Y = np.meshgrid(np.arange(2), np.arange(2))
170+
U = V = angles = np.ones_like(X)
171+
172+
q = ax.quiver(X, Y, U, V, angles=angles)
173+
qk = ax.quiverkey(q, 1, 1, 2, 'Label')
174+
# The arrows are only created when the key is drawn
175+
fig.canvas.draw()
176+
assert len(qk.verts) == 1
177+
164178
if __name__ == '__main__':
165179
import nose
166180
nose.runmodule()

0 commit comments

Comments
 (0)