@@ -129,6 +129,31 @@ def test_quiver_key_pivot():
129129 ax .quiverkey (q , 0 , 0.5 , 1 , 'W' , labelpos = 'W' )
130130
131131
132+ @image_comparison (baseline_images = ['quiver_key_xy' ],
133+ extensions = ['png' ], remove_text = True )
134+ def test_quiver_key_xy ():
135+ # With scale_units='xy', ensure quiverkey still matches its quiver.
136+ # Note that the quiver and quiverkey lengths depend on the axes aspect
137+ # ratio, and that with angles='xy' their angles also depend on the axes
138+ # aspect ratio.
139+ X = np .arange (8 )
140+ Y = np .zeros (8 )
141+ angles = X * (np .pi / 4 )
142+ uv = np .exp (1j * angles )
143+ U = uv .real
144+ V = uv .imag
145+ fig , axs = plt .subplots (2 )
146+ for ax , angle_str in zip (axs , ('uv' , 'xy' )):
147+ ax .set_xlim (- 1 , 8 )
148+ ax .set_ylim (- 0.2 , 0.2 )
149+ q = ax .quiver (X , Y , U , V , pivot = 'middle' ,
150+ units = 'xy' , width = 0.05 ,
151+ scale = 2 , scale_units = 'xy' ,
152+ angles = angle_str )
153+ for x , angle in zip ((0.2 , 0.5 , 0.8 ), (0 , 45 , 90 )):
154+ ax .quiverkey (q , X = x , Y = 0.8 , U = 1 , angle = angle , label = '' , color = 'b' )
155+
156+
132157@image_comparison (baseline_images = ['barbs_test_image' ],
133158 extensions = ['png' ], remove_text = True )
134159def test_barbs ():
0 commit comments