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

Skip to content

Update performance note of hist() to mention stairs(). #25955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2023

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 23, 2023

PR summary

PR checklist

@@ -6700,12 +6700,14 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
--------
hist2d : 2D histogram with rectangular bins
hexbin : 2D histogram with hexagonal bins
stairs : Plot a pre-computed histogram
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add bar since we also recommend bar Y the top for plotting precomputed histograms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 6707 to 6712
For large numbers of bins (>1000), plotting can be significantly
accelerated by setting *histtype* to 'step' or 'stepfilled' rather
than 'bar' or 'barstacked', or by using `~.Axes.stairs` to plot a
pre-computed histogram (``plt.stairs(*np.histogram(data))``).
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For large numbers of bins (>1000), plotting can be significantly
accelerated by setting *histtype* to 'step' or 'stepfilled' rather
than 'bar' or 'barstacked', or by using `~.Axes.stairs` to plot a
pre-computed histogram (``plt.stairs(*np.histogram(data))``).
"""
For large numbers of bins (>1000), plotting can be significantly
accelerated by using `~.Axes.stairs` to plot a
pre-computed histogram (``plt.stairs(*np.histogram(data))``) or by setting *histtype* to 'step' or 'stepfilled' rather
than 'bar' or 'barstacked'.
"""

'rather than' makes the histtype part of the sentence more complex so I think it's easier to parse if it's at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@timhoffm timhoffm added this to the v3.7.2 milestone May 23, 2023
@timhoffm timhoffm merged commit 4384062 into matplotlib:main May 23, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 23, 2023
@anntzer anntzer deleted the hd branch May 23, 2023 14:41
timhoffm added a commit that referenced this pull request May 23, 2023
…955-on-v3.7.x

Backport PR #25955 on branch v3.7.x (Update performance note of hist() to mention stairs().)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants