🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.5 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.6.dev0 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.1 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.0 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › doc › 2.4 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.4 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.2 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v2.3 Manual
>>> # Generate non-symmetric test data >>> n = 10000 >>> x = np.linspace(1, 100, n) >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
🌐
NumPy
numpy.org › doc › 1.18 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.18 Manual
May 24, 2020 - Examples · >>> from matplotlib.image import NonUniformImage >>> import matplotlib.pyplot as plt · Construct a 2-D histogram with variable bin width. First define the bin edges: >>> xedges = [0, 1, 3, 5] >>> yedges = [0, 2, 3, 4, 6] Next we create a histogram H with random bin content: >>> ...
🌐
NumPy
numpy.org › doc › 1.17 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.17 Manual
February 18, 2020 - Examples · >>> from matplotlib.image import NonUniformImage >>> import matplotlib.pyplot as plt · Construct a 2-D histogram with variable bin width. First define the bin edges: >>> xedges = [0, 1, 3, 5] >>> yedges = [0, 2, 3, 4, 6] Next we create a histogram H with random bin content: >>> ...
Find elsewhere
🌐
SciPy
docs.scipy.org › doc › numpy-1.10.1 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.10 Manual
>>> x = np.random.normal(3, 1, 100) >>> y = np.random.normal(1, 1, 100) >>> H, xedges, yedges = np.histogram2d(y, x, bins=(xedges, yedges))
🌐
SciPy
docs.scipy.org › doc › numpy-1.13.0 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.13 Manual
>>> x = np.random.normal(2, 1, 100) >>> y = np.random.normal(1, 1, 100) >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) >>> H = H.T # Let each row list bins with common y range.
🌐
SciPy
docs.scipy.org › doc › numpy-1.9.2 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.9 Manual
October 18, 2015 - >>> x = np.random.normal(3, 1, 100) >>> y = np.random.normal(1, 1, 100) >>> H, xedges, yedges = np.histogram2d(y, x, bins=(xedges, yedges))
🌐
Python Pool
pythonpool.com › home › matplotlib › matplotlib 2d histogram: hist2d(), bins, lognorm, and colorbars
Matplotlib 2D Histogram: hist2d(), Bins, LogNorm, and Colorbars
July 13, 2026 - import numpy as np rng = np.random.default_rng(11) x = rng.normal(size=1000) y = rng.normal(size=1000) counts, xedges, yedges = np.histogram2d(x, y, bins=20) print(counts.shape) print(xedges[:3]) print(yedges[:3])
🌐
SciPy
docs.scipy.org › doc › numpy-1.15.0 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.15 Manual - SciPy.org
>>> x = np.random.normal(2, 1, 100) >>> y = np.random.normal(1, 1, 100) >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) >>> H = H.T # Let each row list bins with common y range.
🌐
SciPy
docs.scipy.org › doc › numpy-1.6.0 › reference › generated › numpy.histogram2d.html
numpy.histogram2d — NumPy v1.6 Manual (DRAFT)
May 15, 2011 - >>> x, y = np.random.randn(2, 100) >>> H, xedges, yedges = np.histogram2d(x, y, bins=(5, 8)) >>> H.shape, xedges.shape, yedges.shape ((5, 8), (6,), (9,))
🌐
CodeSpeedy
codespeedy.com › home › how does numpy.histogram2d works in python
How does numpy.histogram2d works in Python - CodeSpeedy
October 28, 2022 - x = np.random.normal(2, 1, 100) y = np.random.normal(1, 1, 100) H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) H = H.T
🌐
Python Data Science Handbook
jakevdp.github.io › PythonDataScienceHandbook › 04.05-histograms-and-binnings.html
Histograms, Binnings, and Density | Python Data Science Handbook
Just as with plt.hist, plt.hist2d has a number of extra options to fine-tune the plot and the binning, which are nicely outlined in the function docstring. Further, just as plt.hist has a counterpart in np.histogram, plt.hist2d has a counterpart in np.histogram2d, which can be used as follows:
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.histogramdd.html
numpy.histogramdd — NumPy v2.4 Manual
January 31, 2021 - histogram2d · 2-D histogram · Examples · Try it in your browser!