Struct audio_processor_testing_helpers::charts::Quartiles
source · pub struct Quartiles { /* private fields */ }Expand description
The quartiles
Implementations§
source§impl Quartiles
impl Quartiles
sourcepub fn new<T>(s: &[T]) -> Quartileswhere
T: Into<f64> + Copy + PartialOrd<T>,
pub fn new<T>(s: &[T]) -> Quartileswhere T: Into<f64> + Copy + PartialOrd<T>,
Create a new quartiles struct with the values calculated from the argument.
s: The array of the original values- returns The newly created quartiles
use plotters::prelude::*;
let quartiles = Quartiles::new(&[7, 15, 36, 39, 40, 41]);
assert_eq!(quartiles.median(), 37.5);sourcepub fn values(&self) -> [f32; 5]
pub fn values(&self) -> [f32; 5]
Get the quartiles values.
- returns The array [lower fence, lower quartile, median, upper quartile, upper fence]
use plotters::prelude::*;
let quartiles = Quartiles::new(&[7, 15, 36, 39, 40, 41]);
let values = quartiles.values();
assert_eq!(values, [-9.0, 20.25, 37.5, 39.75, 69.0]);