generate Histogram2D
fun <T, X : Comparable<X>, Number, Y : Comparable<Y>, Number> generateHistogram2D(samples: List<T>, xDomain: ClosedRange<X>, yDomain: ClosedRange<Y>, xGetter: (T) -> X, yGetter: (T) -> Y, nBinsX: Int = 100, nBinsY: Int = 100): HeatMapGrid<Int>
Generates a 2D histogram from a list of samples.
Creates a 2D grid where each cell contains the count of samples that fall within that cell's boundaries. Samples outside the specified domains are ignored (clipped).
Return
HeatMapGrid containing the histogram counts
Parameters
samples
List of data points to histogram
n Bins X
Number of bins along x-axis
n Bins Y
Number of bins along y-axis
x Domain
Range of x-values to include in histogram
y Domain
Range of y-values to include in histogram
x Getter
Function to extract x-coordinate from a sample
y Getter
Function to extract y-coordinate from a sample
Type Parameters
T
The type of data points being processed
X
The numeric type for x-coordinates
Y
The numeric type for y-coordinates