diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index de4a99f71d24..2412f815cd42 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -6466,7 +6466,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, `~.stairs` to plot the distribution:: counts, bins = np.histogram(x) - plt.stairs(bins, counts) + plt.stairs(counts, bins) Alternatively, plot pre-computed bins and counts using ``hist()`` by treating each bin as a single point with a weight equal to its count::