Skip to main content
Ctrl+K
Logo image
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases

Section Navigation

  • Pairwise data
    • plot(x, y)
    • scatter(x, y)
    • bar(x, height)
    • stem(x, y)
    • fill_between(x, y1, y2)
    • stackplot(x, y)
    • stairs(values)
  • Statistical distributions
    • hist(x)
    • boxplot(X)
    • errorbar(x, y, yerr, xerr)
    • violinplot(D)
    • eventplot(D)
    • hist2d(x, y)
    • hexbin(x, y, C)
    • pie(x)
    • ecdf(x)
  • Gridded data:
    • imshow(Z)
    • pcolormesh(X, Y, Z)
    • contour(X, Y, Z)
    • contourf(X, Y, Z)
    • barbs(X, Y, U, V)
    • quiver(X, Y, U, V)
    • streamplot(X, Y, U, V)
  • Irregularly gridded data
    • tricontour(x, y, z)
    • tricontourf(x, y, z)
    • tripcolor(x, y, z)
    • triplot(x, y)
  • 3D and volumetric data
    • scatter(xs, ys, zs)
    • plot_surface(X, Y, Z)
    • plot_trisurf(x, y, z)
    • voxels([x, y, z], filled)
    • plot_wireframe(X, Y, Z)
  • Plot types
  • Pairwise data
  • stairs(values)

Note

Go to the end to download the full example code

stairs(values)#

See 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()

Download Python source code: stairs.py

Download Jupyter notebook: stairs.ipynb

Gallery generated by Sphinx-Gallery

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2023 The Matplotlib development team.

Created using Sphinx 7.2.6.

Built from v3.8.2-2-gd98fee6e0e.

Built with the PyData Sphinx Theme 0.13.3.