Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48891e5

Browse files
authored
Merge pull request #25959 from meeseeksmachine/auto-backport-of-pr-25955-on-v3.7.x
Backport PR #25955 on branch v3.7.x (Update performance note of hist() to mention stairs().)
2 parents ec31759 + 5ddd807 commit 48891e5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6669,12 +6669,15 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
66696669
--------
66706670
hist2d : 2D histogram with rectangular bins
66716671
hexbin : 2D histogram with hexagonal bins
6672+
stairs : Plot a pre-computed histogram
6673+
bar : Plot a pre-computed histogram
66726674
66736675
Notes
66746676
-----
6675-
For large numbers of bins (>1000), plotting can be significantly faster
6676-
if *histtype* is set to 'step' or 'stepfilled' rather than 'bar' or
6677-
'barstacked'.
6677+
For large numbers of bins (>1000), plotting can be significantly
6678+
accelerated by using `~.Axes.stairs` to plot a pre-computed histogram
6679+
(``plt.stairs(*np.histogram(data))``), or by setting *histtype* to
6680+
'step' or 'stepfilled' rather than 'bar' or 'barstacked'.
66786681
"""
66796682
# Avoid shadowing the builtin.
66806683
bin_range = range

0 commit comments

Comments
 (0)