(fig_test, fig_ref)
| 2653 | |
| 2654 | @check_figures_equal() |
| 2655 | def test_stairs(fig_test, fig_ref): |
| 2656 | import matplotlib.lines as mlines |
| 2657 | y = np.array([6, 14, 32, 37, 48, 32, 21, 4]) # hist |
| 2658 | x = np.array([1., 2., 3., 4., 5., 6., 7., 8., 9.]) # bins |
| 2659 | |
| 2660 | test_axes = fig_test.subplots(3, 2).flatten() |
| 2661 | test_axes[0].stairs(y, x, baseline=None) |
| 2662 | test_axes[1].stairs(y, x, baseline=None, orientation='horizontal') |
| 2663 | test_axes[2].stairs(y, x) |
| 2664 | test_axes[3].stairs(y, x, orientation='horizontal') |
| 2665 | test_axes[4].stairs(y, x) |
| 2666 | test_axes[4].semilogy() |
| 2667 | test_axes[5].stairs(y, x, orientation='horizontal') |
| 2668 | test_axes[5].semilogx() |
| 2669 | |
| 2670 | # defaults of `PathPatch` to be used for all following Line2D |
| 2671 | style = {'solid_joinstyle': 'miter', 'solid_capstyle': 'butt'} |
| 2672 | |
| 2673 | ref_axes = fig_ref.subplots(3, 2).flatten() |
| 2674 | ref_axes[0].plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style) |
| 2675 | ref_axes[1].plot(np.append(y[0], y), x, drawstyle='steps-post', **style) |
| 2676 | |
| 2677 | ref_axes[2].plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style) |
| 2678 | ref_axes[2].add_line(mlines.Line2D([x[0], x[0]], [0, y[0]], **style)) |
| 2679 | ref_axes[2].add_line(mlines.Line2D([x[-1], x[-1]], [0, y[-1]], **style)) |
| 2680 | ref_axes[2].set_ylim(0, None) |
| 2681 | |
| 2682 | ref_axes[3].plot(np.append(y[0], y), x, drawstyle='steps-post', **style) |
| 2683 | ref_axes[3].add_line(mlines.Line2D([0, y[0]], [x[0], x[0]], **style)) |
| 2684 | ref_axes[3].add_line(mlines.Line2D([0, y[-1]], [x[-1], x[-1]], **style)) |
| 2685 | ref_axes[3].set_xlim(0, None) |
| 2686 | |
| 2687 | ref_axes[4].plot(x, np.append(y, y[-1]), drawstyle='steps-post', **style) |
| 2688 | ref_axes[4].add_line(mlines.Line2D([x[0], x[0]], [0, y[0]], **style)) |
| 2689 | ref_axes[4].add_line(mlines.Line2D([x[-1], x[-1]], [0, y[-1]], **style)) |
| 2690 | ref_axes[4].semilogy() |
| 2691 | |
| 2692 | ref_axes[5].plot(np.append(y[0], y), x, drawstyle='steps-post', **style) |
| 2693 | ref_axes[5].add_line(mlines.Line2D([0, y[0]], [x[0], x[0]], **style)) |
| 2694 | ref_axes[5].add_line(mlines.Line2D([0, y[-1]], [x[-1], x[-1]], **style)) |
| 2695 | ref_axes[5].semilogx() |
| 2696 | |
| 2697 | |
| 2698 | @check_figures_equal() |
nothing calls this directly
no test coverage detected
searching dependent graphs…