| 789 | |
| 790 | @image_comparison(['arrow_simple.png'], remove_text=True, style='_classic_test') |
| 791 | def test_arrow_simple(): |
| 792 | # Simple image test for ax.arrow |
| 793 | # kwargs that take discrete values |
| 794 | length_includes_head = (True, False) |
| 795 | shape = ('full', 'left', 'right') |
| 796 | head_starts_at_zero = (True, False) |
| 797 | # Create outer product of values |
| 798 | kwargs = product(length_includes_head, shape, head_starts_at_zero) |
| 799 | |
| 800 | fig, axs = plt.subplots(3, 4) |
| 801 | for i, (ax, kwarg) in enumerate(zip(axs.flat, kwargs)): |
| 802 | ax.set_xlim(-2, 2) |
| 803 | ax.set_ylim(-2, 2) |
| 804 | # Unpack kwargs |
| 805 | (length_includes_head, shape, head_starts_at_zero) = kwarg |
| 806 | theta = 2 * np.pi * i / 12 |
| 807 | # Draw arrow |
| 808 | ax.arrow(0, 0, np.sin(theta), np.cos(theta), |
| 809 | width=theta/100, |
| 810 | length_includes_head=length_includes_head, |
| 811 | shape=shape, |
| 812 | head_starts_at_zero=head_starts_at_zero, |
| 813 | head_width=theta / 10, |
| 814 | head_length=theta / 10) |
| 815 | |
| 816 | |
| 817 | def test_arrow_empty(): |