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

Function test_stairs_options

lib/matplotlib/tests/test_axes.py:2792–2812  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2790
2791@image_comparison(['test_stairs_options.png'], style='mpl20', remove_text=True)
2792def test_stairs_options():
2793 x, y = np.array([1, 2, 3, 4, 5]), np.array([1, 2, 3, 4]).astype(float)
2794 yn = y.copy()
2795 yn[1] = np.nan
2796
2797 fig, ax = plt.subplots()
2798 ax.stairs(y*3, x, color='green', fill=True, label="A")
2799 ax.stairs(y, x*3-3, color='red', fill=True,
2800 orientation='horizontal', label="B")
2801 ax.stairs(yn, x, color='orange', ls='--', lw=2, label="C")
2802 ax.stairs(yn/3, x*3-2, ls='--', lw=2, baseline=0.5,
2803 orientation='horizontal', label="D")
2804 ax.stairs(y[::-1]*3+13, x-1, color='red', ls='--', lw=2, baseline=None,
2805 label="E")
2806 ax.stairs(y[::-1]*3+14, x, baseline=26,
2807 color='purple', ls='--', lw=2, label="F")
2808 ax.stairs(yn[::-1]*3+15, x+1, baseline=np.linspace(27, 25, len(y)),
2809 color='blue', ls='--', label="G", fill=True)
2810 ax.stairs(y[:-1][::-1]*2+11, x[:-1]+0.5, color='black', ls='--', lw=2,
2811 baseline=12, hatch='//', label="H")
2812 ax.legend(loc=0)
2813
2814
2815@image_comparison(['test_stairs_datetime.png'], style='mpl20')

Callers

nothing calls this directly

Calls 4

stairsMethod · 0.80
copyMethod · 0.45
subplotsMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…