generateHistogram2D

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

T

The type of data points being processed

X

The numeric type for x-coordinates

Y

The numeric type for y-coordinates

samples

List of data points to histogram

nBinsX

Number of bins along x-axis

nBinsY

Number of bins along y-axis

xDomain

Range of x-values to include in histogram

yDomain

Range of y-values to include in histogram

xGetter

Function to extract x-coordinate from a sample

yGetter

Function to extract y-coordinate from a sample