@@ -758,15 +758,25 @@ def test_mixedsamplesraises():
758
758
759
759
760
760
@mpl3d_image_comparison (
761
- ['quiver3d.png' , 'quiver3d_pivot_middle.png' , 'quiver3d_pivot_tail.png' ])
761
+ ['quiver3d.png' ])
762
762
def test_quiver3d ():
763
- x , y , z = np .ogrid [- 1 :0.8 :10j , - 1 :0.8 :10j , - 1 :0.6 :3j ]
764
- u = np .sin (np .pi * x ) * np .cos (np .pi * y ) * np .cos (np .pi * z )
765
- v = - np .cos (np .pi * x ) * np .sin (np .pi * y ) * np .cos (np .pi * z )
766
- w = (2 / 3 )** 0.5 * np .cos (np .pi * x ) * np .cos (np .pi * y ) * np .sin (np .pi * z )
767
- for pivot in ['tip' , 'middle' , 'tail' ]:
768
- ax = plt .figure ().add_subplot (projection = '3d' )
769
- ax .quiver (x , y , z , u , v , w , length = 0.1 , pivot = pivot , normalize = True )
763
+ fig = plt .figure ()
764
+ ax = fig .add_subplot (projection = '3d' )
765
+ pivots = ['tip' , 'middle' , 'tail' ]
766
+ colors = ['tab:blue' , 'tab:orange' , 'tab:green' ]
767
+ for i , (pivot , color ) in enumerate (zip (pivots , colors )):
768
+ x , y , z = np .meshgrid ([- 0.5 , 0.5 ], [- 0.5 , 0.5 ], [- 0.5 , 0.5 ])
769
+ u = - x
770
+ v = - y
771
+ w = - z
772
+ # Offset each set in z direction
773
+ z += 2 * i
774
+ ax .quiver (x , y , z , u , v , w , length = 1 , pivot = pivot , color = color )
775
+ ax .scatter (x , y , z , color = color )
776
+
777
+ ax .set_xlim (- 3 , 3 )
778
+ ax .set_ylim (- 3 , 3 )
779
+ ax .set_zlim (- 1 , 5 )
770
780
771
781
772
782
@check_figures_equal (extensions = ["png" ])
0 commit comments