| 5884 | @image_comparison(['step_linestyle', 'step_linestyle'], remove_text=True, |
| 5885 | style='_classic_test', tol=0.2) |
| 5886 | def test_step_linestyle(): |
| 5887 | # Tolerance caused by reordering of floating-point operations |
| 5888 | # Remove when regenerating the images |
| 5889 | x = y = np.arange(10) |
| 5890 | |
| 5891 | # First illustrate basic pyplot interface, using defaults where possible. |
| 5892 | fig, ax_lst = plt.subplots(2, 2) |
| 5893 | ax_lst = ax_lst.flatten() |
| 5894 | |
| 5895 | ln_styles = ['-', '--', '-.', ':'] |
| 5896 | |
| 5897 | for ax, ls in zip(ax_lst, ln_styles): |
| 5898 | ax.step(x, y, lw=5, linestyle=ls, where='pre') |
| 5899 | ax.step(x, y + 1, lw=5, linestyle=ls, where='mid') |
| 5900 | ax.step(x, y + 2, lw=5, linestyle=ls, where='post') |
| 5901 | ax.set_xlim(-1, 5) |
| 5902 | ax.set_ylim(-1, 7) |
| 5903 | |
| 5904 | # Reuse testcase from above for a labeled data test |
| 5905 | data = {"X": x, "Y0": y, "Y1": y+1, "Y2": y+2} |
| 5906 | fig, ax_lst = plt.subplots(2, 2) |
| 5907 | ax_lst = ax_lst.flatten() |
| 5908 | ln_styles = ['-', '--', '-.', ':'] |
| 5909 | for ax, ls in zip(ax_lst, ln_styles): |
| 5910 | ax.step("X", "Y0", lw=5, linestyle=ls, where='pre', data=data) |
| 5911 | ax.step("X", "Y1", lw=5, linestyle=ls, where='mid', data=data) |
| 5912 | ax.step("X", "Y2", lw=5, linestyle=ls, where='post', data=data) |
| 5913 | ax.set_xlim(-1, 5) |
| 5914 | ax.set_ylim(-1, 7) |
| 5915 | |
| 5916 | |
| 5917 | @image_comparison(['mixed_collection'], remove_text=True, style='_classic_test') |