This library is meant to plot histograms, not calculate quantiles, median, etc which other libraries already do.
Disclaimer
I am no expert. If you find another library that does the same, it probably does it better and faster. I don't know if I will ever update this project or add any functionalities.
No test have been run on this project
I created this library for two reasons :
- I wanted to make histograms and plot them from vectors without having to write 20 lines of code and interacting with multiple libraries. I found some that created a histogram but none that allowed to directly plot them (or maybe i was too dumb to realize they did), or they required too much boilerplate.
- I'm new to rust and it's a good exercise. (expect errors)
The way this library works is pretty simple.
- Create a
Vec<f64>, the put your data in it and process them in any way you like. - Turn it into a
Histogramby specifying aRange, and a number of steps. - Plot it, or use the Vectors generated.
use simple_histograms::{from_vec, Range};
let values = vec![1.0, 2.0, 3.0, 4.0, 4.0, 5.0];
let hist = from_vec(values, Range::Specified(2.0, 4.0), 3);
assert_eq!(*hist.get_ys(), [1, 1, 2]);