composeui.core.histogram

Bin samples for a histogram.

class composeui.core.histogram.HistogramMode[source]

Bases: Enum

What the height of each bin represents.

COUNT = 'count'
PERCENT = 'percent'
DENSITY = 'density'
composeui.core.histogram.histogram(samples, edges, *, mode=HistogramMode.COUNT)[source]

Compute one height per interval between consecutive edges.

Give at least two finite, strictly increasing edges. Each interval includes its left edge. Only the last includes its right edge. The calculation skips samples outside the edges and NaNs.

HistogramMode.COUNT gives the number of samples in each bin. HistogramMode.PERCENT gives the percentage of samples inside the edges. HistogramMode.DENSITY divides the fraction of those samples by the bin width. It raises ValueError if a positive density is outside the range of finite floats. If no samples are inside the edges, all heights are zero in every mode.

Parameters:
Return type:

tuple[float, …]