| 156 | |
| 157 | @image_comparison(['quiver_key_xy.png'], remove_text=True, style='_classic_test') |
| 158 | def test_quiver_key_xy(): |
| 159 | # With scale_units='xy', ensure quiverkey still matches its quiver. |
| 160 | # Note that the quiver and quiverkey lengths depend on the axes aspect |
| 161 | # ratio, and that with angles='xy' their angles also depend on the axes |
| 162 | # aspect ratio. |
| 163 | X = np.arange(8) |
| 164 | Y = np.zeros(8) |
| 165 | angles = X * (np.pi / 4) |
| 166 | uv = np.exp(1j * angles) |
| 167 | U = uv.real |
| 168 | V = uv.imag |
| 169 | fig, axs = plt.subplots(2) |
| 170 | for ax, angle_str in zip(axs, ('uv', 'xy')): |
| 171 | ax.set_xlim(-1, 8) |
| 172 | ax.set_ylim(-0.2, 0.2) |
| 173 | q = ax.quiver(X, Y, U, V, pivot='middle', |
| 174 | units='xy', width=0.05, |
| 175 | scale=2, scale_units='xy', |
| 176 | angles=angle_str) |
| 177 | for x, angle in zip((0.2, 0.5, 0.8), (0, 45, 90)): |
| 178 | ax.quiverkey(q, X=x, Y=0.8, U=1, angle=angle, label='', color='b') |
| 179 | |
| 180 | |
| 181 | @image_comparison(['barbs_test_image.png'], remove_text=True, style='_classic_test') |