| 966 | |
| 967 | |
| 968 | def test_arrow_set_data(): |
| 969 | fig, ax = plt.subplots() |
| 970 | arrow = mpl.patches.Arrow(2, 0, 0, 10) |
| 971 | expected1 = np.array( |
| 972 | [[1.9, 0.], |
| 973 | [2.1, -0.], |
| 974 | [2.1, 8.], |
| 975 | [2.3, 8.], |
| 976 | [2., 10.], |
| 977 | [1.7, 8.], |
| 978 | [1.9, 8.], |
| 979 | [1.9, 0.]] |
| 980 | ) |
| 981 | assert np.allclose(expected1, np.round(arrow.get_verts(), 2)) |
| 982 | |
| 983 | expected2 = np.array( |
| 984 | [[0.39, 0.04], |
| 985 | [0.61, -0.04], |
| 986 | [3.01, 6.36], |
| 987 | [3.24, 6.27], |
| 988 | [3.5, 8.], |
| 989 | [2.56, 6.53], |
| 990 | [2.79, 6.44], |
| 991 | [0.39, 0.04]] |
| 992 | ) |
| 993 | arrow.set_data(x=.5, dx=3, dy=8, width=1.2) |
| 994 | assert np.allclose(expected2, np.round(arrow.get_verts(), 2)) |
| 995 | |
| 996 | |
| 997 | @check_figures_equal(extensions=["png", "pdf", "svg", "eps"]) |