MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_stairs_update

Function test_stairs_update

lib/matplotlib/tests/test_axes.py:2725–2745  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

2723
2724@check_figures_equal()
2725def 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()

Callers

nothing calls this directly

Calls 6

add_subplotMethod · 0.80
stairsMethod · 0.80
allcloseMethod · 0.80
set_ylimMethod · 0.45
set_dataMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…