@@ -371,33 +371,23 @@ def test_mixedsamplesraises():
371
371
ax .plot_surface (X , Y , Z , cstride = 50 , rcount = 10 )
372
372
373
373
374
- @mpl3d_image_comparison (['quiver3d.png' ])
374
+ @mpl3d_image_comparison (
375
+ ['quiver3d.png' , 'quiver3d_pivot_middle.png' , 'quiver3d_pivot_tail.png' ])
375
376
def test_quiver3d ():
376
- fig = plt .figure ()
377
- ax = fig .gca (projection = '3d' )
378
-
379
377
x , y , z = np .ogrid [- 1 :0.8 :10j , - 1 :0.8 :10j , - 1 :0.6 :3j ]
380
-
381
378
u = np .sin (np .pi * x ) * np .cos (np .pi * y ) * np .cos (np .pi * z )
382
379
v = - np .cos (np .pi * x ) * np .sin (np .pi * y ) * np .cos (np .pi * z )
383
- w = (np .sqrt (2.0 / 3.0 ) * np .cos (np .pi * x ) * np .cos (np .pi * y ) *
384
- np .sin (np .pi * z ))
380
+ w = (2 / 3 )** 0.5 * np .cos (np .pi * x ) * np .cos (np .pi * y ) * np .sin (np .pi * z )
381
+ for pivot in ['tip' , 'middle' , 'tail' ]:
382
+ ax = plt .figure ().add_subplot (projection = '3d' )
383
+ ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = pivot , normalize = True )
385
384
386
- ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = 'tip' , normalize = True )
387
-
388
-
389
- @mpl3d_image_comparison (['quiver3d_empty.png' ])
390
- def test_quiver3d_empty ():
391
- fig = plt .figure ()
392
- ax = fig .gca (projection = '3d' )
393
-
394
- x , y , z = np .ogrid [- 1 :0.8 :0j , - 1 :0.8 :0j , - 1 :0.6 :0j ]
395
-
396
- u = np .sin (np .pi * x ) * np .cos (np .pi * y ) * np .cos (np .pi * z )
397
- v = - np .cos (np .pi * x ) * np .sin (np .pi * y ) * np .cos (np .pi * z )
398
- w = (np .sqrt (2.0 / 3.0 ) * np .cos (np .pi * x ) * np .cos (np .pi * y ) *
399
- np .sin (np .pi * z ))
400
385
386
+ @check_figures_equal (extensions = ["png" ])
387
+ def test_quiver3d_empty (fig_test , fig_ref ):
388
+ fig_ref .add_subplot (projection = '3d' )
389
+ x = y = z = u = v = w = []
390
+ ax = fig_test .add_subplot (projection = '3d' )
401
391
ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = 'tip' , normalize = True )
402
392
403
393
@@ -412,44 +402,13 @@ def test_quiver3d_masked():
412
402
413
403
u = np .sin (np .pi * x ) * np .cos (np .pi * y ) * np .cos (np .pi * z )
414
404
v = - np .cos (np .pi * x ) * np .sin (np .pi * y ) * np .cos (np .pi * z )
415
- w = (np .sqrt (2.0 / 3.0 ) * np .cos (np .pi * x ) * np .cos (np .pi * y ) *
416
- np .sin (np .pi * z ))
405
+ w = (2 / 3 )** 0.5 * np .cos (np .pi * x ) * np .cos (np .pi * y ) * np .sin (np .pi * z )
417
406
u = np .ma .masked_where ((- 0.4 < x ) & (x < 0.1 ), u , copy = False )
418
407
v = np .ma .masked_where ((0.1 < y ) & (y < 0.7 ), v , copy = False )
419
408
420
409
ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = 'tip' , normalize = True )
421
410
422
411
423
- @mpl3d_image_comparison (['quiver3d_pivot_middle.png' ])
424
- def test_quiver3d_pivot_middle ():
425
- fig = plt .figure ()
426
- ax = fig .gca (projection = '3d' )
427
-
428
- x , y , z = np .ogrid [- 1 :0.8 :10j , - 1 :0.8 :10j , - 1 :0.6 :3j ]
429
-
430
- u = np .sin (np .pi * x ) * np .cos (np .pi * y ) * np .cos (np .pi * z )
431
- v = - np .cos (np .pi * x ) * np .sin (np .pi * y ) * np .cos (np .pi * z )
432
- w = (np .sqrt (2.0 / 3.0 ) * np .cos (np .pi * x ) * np .cos (np .pi * y ) *
433
- np .sin (np .pi * z ))
434
-
435
- ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = 'middle' , normalize = True )
436
-
437
-
438
- @mpl3d_image_comparison (['quiver3d_pivot_tail.png' ])
439
- def test_quiver3d_pivot_tail ():
440
- fig = plt .figure ()
441
- ax = fig .gca (projection = '3d' )
442
-
443
- x , y , z = np .ogrid [- 1 :0.8 :10j , - 1 :0.8 :10j , - 1 :0.6 :3j ]
444
-
445
- u = np .sin (np .pi * x ) * np .cos (np .pi * y ) * np .cos (np .pi * z )
446
- v = - np .cos (np .pi * x ) * np .sin (np .pi * y ) * np .cos (np .pi * z )
447
- w = (np .sqrt (2.0 / 3.0 ) * np .cos (np .pi * x ) * np .cos (np .pi * y ) *
448
- np .sin (np .pi * z ))
449
-
450
- ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = 'tail' , normalize = True )
451
-
452
-
453
412
@mpl3d_image_comparison (['poly3dcollection_closed.png' ])
454
413
def test_poly3dcollection_closed ():
455
414
fig = plt .figure ()
0 commit comments