Function textplots::utils::histogram

source ·
pub fn histogram(
    data: &[(f32, f32)],
    min: f32,
    max: f32,
    bins: usize
) -> Vec<(f32, f32)>
Expand description

Transforms points into frequency distribution (for using in histograms). Values outside of [min, max] interval are ignored, and everything that falls into the specified interval is grouped into bins number of buckets of equal width.

assert_eq!(vec![(0.0, 1.0), (5.0, 1.0)], histogram( &[ (0.0, 0.0), (9.0, 9.0), (10.0, 10.0) ], 0.0, 10.0, 2 ));