2D Histogram

Calculates and draws the 3D histogram of 2 Dimensional input data

You are now following this Submission

function H = hist2d(D,Xn,Yn,[Xlo Xhi],[Ylo Yhi])

Calculates and draws the 3D histogram of 2 Dimensional input data D.

Counts number of points in the bins defined by
X = linspace(Xlo,Xhi,Xn) and
Y = linspace(Ylo,Yhi,Yn)

D must be a 2 column or 2 row matrix or an array of complex numbers

[Xlo Xhi],[Ylo Yhi] are optional and default to the min and max of
the input data
Xn and Yn are optional and default to 20

Example:
hist2d([randn(1,10000); randn(1,10000)])

Really just a copy of 2D Histogram, by Rey Patlolla, but with default arguments, optionally complex input and draws a 3D histogram.

Cite As

Murphy O'Brien (2026). 2D Histogram (https://nl.mathworks.com/matlabcentral/fileexchange/14205-2d-histogram), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired by: 2-Dimensional Histogram

Inspired: Fast 2D histogram calculation, createContour

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0