| 2723 | |
| 2724 | @check_figures_equal() |
| 2725 | def test_stairs_update(fig_test, fig_ref): |
| 2726 | # fixed ylim because stairs() does autoscale, but updating data does not |
| 2727 | ylim = -3, 4 |
| 2728 | # Test |
| 2729 | test_ax = fig_test.add_subplot() |
| 2730 | h = test_ax.stairs([1, 2, 3]) |
| 2731 | test_ax.set_ylim(ylim) |
| 2732 | h.set_data([3, 2, 1]) |
| 2733 | h.set_data(edges=np.arange(4)+2) |
| 2734 | h.set_data([1, 2, 1], np.arange(4)/2) |
| 2735 | h.set_data([1, 2, 3]) |
| 2736 | h.set_data(None, np.arange(4)) |
| 2737 | assert np.allclose(h.get_data()[0], np.arange(1, 4)) |
| 2738 | assert np.allclose(h.get_data()[1], np.arange(4)) |
| 2739 | h.set_data(baseline=-2) |
| 2740 | assert h.get_data().baseline == -2 |
| 2741 | |
| 2742 | # Ref |
| 2743 | ref_ax = fig_ref.add_subplot() |
| 2744 | h = ref_ax.stairs([1, 2, 3], baseline=-2) |
| 2745 | ref_ax.set_ylim(ylim) |
| 2746 | |
| 2747 | |
| 2748 | @check_figures_equal() |