@@ -267,6 +267,62 @@ def test_quiverkey_angles():
267
267
assert len (qk .verts ) == 1
268
268
269
269
270
+ def test_quiverkey_angles_xy_aitoff ():
271
+ # GH 26316 and GH 26748
272
+ # Test that only one arrow will be plotted with non-cartesian
273
+ # when angles='xy' and/or scale_units='xy'
274
+
275
+ # only for test purpose
276
+ # scale_units='xy' may not be a valid use case for non-cartesian
277
+ kwargs_list = [
278
+ {'angles' : 'xy' },
279
+ {'angles' : 'xy' , 'scale_units' : 'xy' },
280
+ {'scale_units' : 'xy' }
281
+ ]
282
+
283
+ for kwargs_dict in kwargs_list :
284
+
285
+ x = np .linspace (- np .pi , np .pi , 11 )
286
+ y = np .ones_like (x ) * np .pi / 6
287
+ vx = np .zeros_like (x )
288
+ vy = np .ones_like (x )
289
+
290
+ fig = plt .figure ()
291
+ ax = fig .add_subplot (projection = 'aitoff' )
292
+ q = ax .quiver (x , y , vx , vy , ** kwargs_dict )
293
+ qk = ax .quiverkey (q , 0 , 0 , 1 , '1 units' )
294
+
295
+ fig .canvas .draw ()
296
+ assert len (qk .verts ) == 1
297
+
298
+
299
+ def test_quiverkey_angles_scale_units_cartesian ():
300
+ # GH 26316
301
+ # Test that only one arrow will be plotted with normal cartesian
302
+ # when angles='xy' and/or scale_units='xy'
303
+
304
+ kwargs_list = [
305
+ {'angles' : 'xy' },
306
+ {'angles' : 'xy' , 'scale_units' : 'xy' },
307
+ {'scale_units' : 'xy' }
308
+ ]
309
+
310
+ for kwargs_dict in kwargs_list :
311
+ X = [0 , - 1 , 0 ]
312
+ Y = [0 , - 1 , 0 ]
313
+ U = [1 , - 1 , 1 ]
314
+ V = [1 , - 1 , 0 ]
315
+
316
+ fig , ax = plt .subplots ()
317
+ q = ax .quiver (X , Y , U , V , ** kwargs_dict )
318
+ ax .quiverkey (q , X = 0.3 , Y = 1.1 , U = 1 ,
319
+ label = 'Quiver key, length = 1' , labelpos = 'E' )
320
+ qk = ax .quiverkey (q , 0 , 0 , 1 , '1 units' )
321
+
322
+ fig .canvas .draw ()
323
+ assert len (qk .verts ) == 1
324
+
325
+
270
326
def test_quiver_setuvc_numbers ():
271
327
"""Check that it is possible to set all arrow UVC to the same numbers"""
272
328
0 commit comments