composeui.core.histogram¶
Bin samples for a histogram.
- class composeui.core.histogram.HistogramMode[source]¶
Bases:
EnumWhat 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.COUNTgives the number of samples in each bin.HistogramMode.PERCENTgives the percentage of samples inside the edges.HistogramMode.DENSITYdivides the fraction of those samples by the bin width. It raisesValueErrorif 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:
samples (Iterable[float])
edges (Sequence[float])
mode (HistogramMode)
- Return type: