pub struct Quartiles { /* private fields */ }
Expand description
The quartiles
Implementations§
Source§impl Quartiles
impl Quartiles
Sourcepub fn new<T: Into<f64> + Copy + PartialOrd>(s: &[T]) -> Self
pub fn new<T: Into<f64> + Copy + PartialOrd>(s: &[T]) -> Self
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]);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Quartiles
impl RefUnwindSafe for Quartiles
impl Send for Quartiles
impl Sync for Quartiles
impl Unpin for Quartiles
impl UnwindSafe for Quartiles
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more