#histogram #random #quick #terminal #format #fix #hist

bin+lib v_hist

A really quick way to make histograms that fix the terminal

4 releases

Uses old Rust 2015

0.1.3 Nov 12, 2021
0.1.2 Dec 23, 2019
0.1.1 May 13, 2019
0.1.0 Mar 27, 2019

#23 in #fix

27 downloads per month

MIT license

5KB
89 lines

hist

Terminal histograms


extern crate v_hist;
extern crate rand;

use rand::Rng;

fn main() {
    let mut h = v_hist::init();
    let mut rng = rand::thread_rng();

    // h.max_width = 50;

    for x in 0..200 {
        h.add_entry(format!("{}", x), rng.gen_range(0, 3000)) ;
    }

    h.draw();
}

and Voila

screenshot


Credit where credit is due: https://github.com/JustinMMiller/CUtils

Dependencies

~1.4–8MB
~63K SLoC