[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/stable/api/_as_gen/../../plot_types/unstructured/../basic/stairs.html [Back]  [Original]

stairs(values) — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

stairs(values)#

Draw a stepwise constant function as a line or a filled plot.

See stairs when plotting \(y\) between \((x_i, x_{i+1})\). For plotting \(y\) at \(x\), see step.

stairs [stairs]
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery')

# make data
y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0]

# plot
fig, ax = plt.subplots()

ax.stairs(y, linewidth=2.5)

ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
       ylim=(0, 8), yticks=np.arange(1, 8))

plt.show()

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page